What is the actual RNG that my compiler uses for the rand() function?

Sep 29, 2009 at 8:21pm
I have not been able to find the documentation for it. It always begins with this sequence when I do not seed it with time first.

41
18467
6334
26500
19169
15724
11478
29358
26962
24464
Sep 29, 2009 at 9:38pm
I don't know if it's defined in the standard, but most compilers use a linear congruential generator for rand().
Sep 29, 2009 at 10:01pm
but which LCG would yield the above sequence?
Sep 29, 2009 at 10:58pm
The Wikipedia article on LCGs has the generators for the most popular compilers. You could try each formula to see which one fits.
I don't see what could possibly be the use of doing this, though.
Sep 29, 2009 at 11:03pm
Moreover, the RNG that comes in the standard library is underpowered and not very balanced.
If you really want something nice, google around "mersenne twister".
Topic archived. No new replies allowed.