[Python-Dev] Re: A `cogen' module [was: Re: PEP 218 (sets); moving set.py to Lib]

Tim Peters tim.one@comcast.net
Wed, 28 Aug 2002 17:20:02 -0400

[Jeremy Hylton]
> The last time we talked about random number generation, I remember
> finding a tiny algorithm by Pierre L'Ecuyer based on a recommendation
> from Luc Devroye.  (That's a good pedigree!)  Here's an almost equally
> tiny C extension that wraps up the algorithm.
> We should do a real test of it.  Last time I checked, it wasn't
> obvious how to actually run the DIEHARD tests.

It still isn't, but DIEHARD is likely obsolete now.  Testing for randomness
has become a full-blown science in its own right.  Your government is happy
to give you a bunch of more modern randomness tests developed on a Sun,
complete with a multi-hundred page testing manual every word of which is
vitally important <0.8 wink>:


Note that the Mersenne Twister is likely substantially faster than the
little C program (e.g, it doesn't need division, and on some platforms is
reported to be faster than the uselessly simple-minded C rand()), is
provably equi-distributed through 623 dimensions (linear congruential
generators are damned luck to get 6), has a period of nearly 2**20000, and
is probably the most widely tested generator in existence now.  Knuth was
reported as saying "well, I guess that about wraps it up for random number
generation!", although I'd be more likely to believe L'Ecuyer or Marsaglia
on this particular topic <wink>.