[Python-Dev] random number generator state

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Aug 16 04:38:41 CEST 2009

Scott David Daniels wrote:
> I find I have a need in randomized testing for a shorter version
> of getstate, even if it _is_ slower to restore.  When running
> exhaustive tests, a failure report should show the start state
> of the generator.  Unfortunately, our current state includes a
> 625-element array.

Do you need to use the Mersenne Twister in particular
for this? There are other kinds of generator with very
long cycles and good statistical properties, that can
easily be restored to any state in constant time given
an initial state and a count.

Let me know if you're interested and I can give you
further details.


More information about the Python-Dev mailing list