|P is for Practical|
Random numbers are not random enough on Windowsby kikuchiyo (Pilgrim)
|on Oct 28, 2009 at 10:06 UTC||Need Help??|
kikuchiyo has asked for the wisdom of the Perl Monks concerning the following question:
I noticed something about the built-in random number generator.
I tried the following:
This code generates 1000000 random numbers, performs the equivalent of sort | uniq -c on them, prints the unique numbers (with their frequencies) into the file randoms.txt, and also prints how many unique random numbers were generated.
On linux (Perl 5.10.0 coming straight from the Ubuntu 9.04 repo) this prints 1000000, meaning that every random number generated was unique. This was expected.
However, on Windows (Perl 5.10.0, the latest Camelbox build) this prints 32768, meaning that only that many unique numbers were generated and there were many duplicates.
Why is the random number generator so crippled in that particular build? Or is this platform-specific?