An algorithm for generating non-repetitive random strings which satisfies the condition

requires the number of generators to meet / ^ [Amurz] {2} d {3} $/
each generation is not repeated
for example, 1000 are generated, 1000 are not repeated
there is no need to remove duplicates such as arrays, it seems that the algorithm can directly guarantee the weight
ask for help

Mar.07,2021

you can generate several in sequence, and then just take one at random


think of the number to be generated as a 36-digit (26-letter + 10-digit) five-digit number that meets the following conditions:

-the range is AA000-ZZ999
-the last three digits are numbers (excluding the last three letters in the above interval)

then number the numbers starting at 0 in order. For example, AA000 is 0, AA001 is 1, and so on, suppose there are a total of m digits. Next, find out the corresponding relationship between the number N and the number n.

Finally, several non-repeating integers between 0murm are generated as needed (this is easy) and converted to 5-bit 36-digit numbers according to the corresponding relationship.

Menu