Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

random

Name: Anonymous 2012-01-01 23:19

hey /prog/.

is there a random number generator algorithm/library that supports something like this: use this seed, give me next nth random number? obviously it shouldn't iterate n times. I don't care if it is not that random.

there is probably something very simple for this but I can't get my head around it.

Name: Anonymous 2012-01-03 12:22

>>1
What for do you need that?

Any old linear congruential generator can do that, obviously: represent one step as a matrix over the modulo field, rise the matrix to n-th power in log(n) steps. But LGCs suck.

The state of the art in PRNG is Mersenne Twister, it can't be fast-forwarded like that apparently, but given its period you can just start with consecutive natural numbers as seeds and be sure to get non-intersecting subsequences of reasonable length. If you want to get some deterministic non-intersecting subsequences. What do you want, OP?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List