P is for Practical | |
PerlMonks |
Re: is rand random enough to simulate dice rolls?by afoken (Chancellor) |
on Jan 03, 2021 at 14:46 UTC ( [id://11126202]=note: print w/replies, xml ) | Need Help?? |
While the above seems to be ok on my platform, can I expect the same result on every platform? and for every perl version around the world? At least old perls for Windows had a very limited PRNG, with an interval of only 2^14 (?). I've no idea how evenly distributed its output is/was. So, the quality of rand() differs from platform to platform and may also change with the perl version. Should I repeat the check 100 times to have an average of averages? Averaging averages won't help. After all, you just sum up n*m numbers and divide by n*m - either in n steps or all at once. Using the median of n averages might help. Update: See also Random numbers are not random enough on Windows and https://www.effectiveperlprogramming.com/2014/06/perl-5-20-uses-its-own-random-number-generator/. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|