[Python-Dev] Re: A `cogen' module [was: Re: PEP 218 (sets); moving
set.py to Lib]
Thu, 29 Aug 2002 14:59:25 -0400
> ... but my experience is out-of-date. I've read Knuth (esp the
> part on testing generators),
Knuth is behind the times here. Better:
But if you're folding in the Twister, you don't have to test ab initio --
you just have to make sure the test vector they supply produces the results
they say it should.
> done numerical analysis, written simulations and high-end crypto, etc.
> The Mersenne Twister algorithm is new to me -- studying it is part of my
> motivation to volunteer to implement it.
It's been implmented for Python several times already (in Python code, and
as a C extension). This is more of an integration and API task than a
write-code-from-scratch task. Do visit the authors' home page:
Indeed, the authors have been reduced <wink> to announcing "yet another
Python module ...".
Note that a subtle weakness was discovered in the seed initialization early
this year, so that implementations older than that are suspect on this
count. BTW, Knuth's lagged Fibonacci generator turned out to have the same
kind of initialization weakness, and was corrected in the ninth printing of
If this stuff interests you <wink>, Ivan Frohne (a statistician) wrote a
wonderful pure-Python random-number package several years ago, including a
pure Python implementation of the Twister, and several other
stronger-than-WH (0, 1) base generators. It's hard to keep track of that
package -- and of Ivan. This may be the most recent version: