4 ms·
The problem that you see here is mostly that rand() gets the range in a way biased towards the lower-order bits, which in more LCGs are less random than the hig
by Scaevolus 17y ago
The problem that you see here is mostly that rand() gets the range in a way biased towards the lower-order bits, which in more LCGs are less random than the higher-order bits.
- jacquesm 17y agoNot only that, they invoke a bunch of float code that then has to balance on getting the rounding of the lowest bit right after a whole bunch of float scaling operations. That's simply not the way to do it when you are only interested in one bit of data to check the random number generator. That's only handy if you want to limit the range of your random numbers between two numbers with a bit more space between them than just the lower order bit. Say 500 and 10000 or 0 and 500 or something like that.