I want to generate random datasets with regex.
Therefore I have an expression like [a-z]{10}.
I want to generate maybe 200.000 data – maybe more (it should be generic), every data should be unique.
How can i implement that?
at the moment i have a algorithm, that generates a random string, then search in an array that stores the values, if the string is already in there it repeats that process. Otherwise it stores the string in the array.
But when I have 200.000 possible data and I want 200.000 different data, it takes a real long time
1) search the whole array every iteration …
2) takes a lot of iterations because there are less possibilities to “hit”
It sounds like you are searching through the entire array each time you want to store a value. Have you considered using a Hash Table with a Key/Value pair?