in reply to is rand random enough to simulate dice rolls?

In choosing a PRNG I would also consider the period (as others pointed out) as well as the CPU burden. And what about the "randomness" of any subset of those 10,000 rolls? That is, you don't want a PRNG which outputs first 10,000/6 1's, followed by 10,0000/6 2's etc. The average of the sum will still be 3.5 but no randomness there.

Random tests are tricky as they may fail randomly but well within their design margins. But consider also how you are going to seed the PRNG for each repeated run. You may leave that to Perl and its "semi-random" way of chosing a seed for you, but is that good enough with repeated runs within the same script or from different ones?

Programmers have it easy: I don't know how a real dice is tested but it must be hard work!

By definition "real" (dice) means imperfect geometry, painting, material density. If you want to emulate a real dice then there's a lot more work than using a fair PRNG.

bw, bliako

  • Comment on Re: is rand random enough to simulate dice rolls?