Random and whrandom

Tim Roberts timr at probo.com
Tue Jan 23 01:23:57 EST 2001


bogus at bogus.net wrote:

>The whrandom algorithm may not generate very good random numbers. I
>created a pair of dice objects and rolled them 10,000 times, there
>seems to be a bias against rolling the same number on both dice.

Umm, in the long term, there SHOULD be a 5-to-1 bias against rolling the
same number on both die.

whrandom is a linear congruential random number generator.  The properties
are well-understood; in the long term, each number in the sequence occurs
once before any number is repeated.  However, short sequences will not show
the same uniformity.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list