Equations to select pseudorandom number in a set I asked a similar question here and it was recommended I check out group theory.
Basically, I want to generate a string of numbers from 5 to 100 characters in length. The sets might be &quot;every 5-number sequence&quot; or &quot;every 15 number sequence&quot; or &quot;every 100 number sequence&quot;. Every n number sequence.
Actually, I don't want to generate it. I want to most optimally find the next random (or pseudo-random) value using something like Group Theory! I can sort of vaguely imagine a way to use modulo to iterate through numbers in a set in a seemingly random way, and then at the same time never encounter the same number twice. (Or know if you are, and have some optimized solution to finding a nearby number or something).
Is there any way to accomplish this in Group Theory or otherwise? If not, that would be good to know to, why you can't accomplish this. But maybe there is an equation to do this.
For example, one thing I'm thinking that is better than a straight sequence is to go like a dampening wave. Say the set is from 100-999 (all 3-letter sequences). Then you would go:
100
999
101
998
102
997
...

That still doesn't appear random though, you can figure out that pattern in your head (even though I don't know what the equation is).
I would like something like that, where I can simply increment and index and have an equation to spit out the value.
If the set is large it's easy to just pick a random number and repeat if you get the same one, so that you get unique ones.
If the set is very small it might be best to randomly shuffle the list and pick the first n of that.
In the middle, perhaps the best way would be to store a list of indices that have already been taken and increment the randomly generated index for each time it is &gt;= a taken index.
If the set is large it's easy to just pick a random number and repeat if you get the same one, so that you get unique ones.
If the set is very small it might be best to randomly shuffle the list and pick the first n of that.
In the middle, perhaps the best way would be to store a list of indices that have already been taken and increment the randomly generated index for each time it is &gt;= a taken index.