-- Write it in pure python as a drop-in replacement for Wichman-Hill.
Yup. I think the seed arguments are different though -- MT takes a single int, while whrandom takes three ints in range(256).
-- Add a version number argument to Random() which defaults to two. If set to one, use the old generator so that it is possible to recreate sequences from earlier versions of Python. Note, the code is much shorter if we drop this requirement. On the plus side, it gives more than backwards compatability, it gives the ability to re-run a simulation with another generator to assure that the result isn't a fluke related to a generator design flaw.
I think this is useful. But I'd like to hear what Tim has to say.
-- Document David Abrahams's link to http://www.boost.org/boost/random/mersenne_twister.hpp as the reference implementation and
Hm. What part of that file contains the actual algorithm? I gues the
function void mersenne_twister
http://www.math.keio.ac.jp/matumoto/emt.html as a place for more information. Key-off of the MT19337 version as the most recent stable evolution.
Sure. It would be nice to have at least *some* documentation in-line in case those links disappear. Maybe you can quote the relevant C++ code from the Boost version (with attribution) in a comment.
-- Move the existing in-module test-suite into a unittest. Add a new, separate unittest suite with tests specific to MT (recreating a few sequences produced by reference implementations) and with a battery of Knuth style tests. The validation results are at: http://www.math.keio.ac.jp/matumoto/ver991029.html
It might be fun to have some heavy duty tests (which take hours or days to run) checked in but not run by default. We usually do this by not naming the test file test_foo.py; it can then be run manually.
-- When we're done, have a python link put on the Mersenne Twister Home Page (the second link above).
Sounds like they would be only too eager to comply. :-)
-- Write, test and document the generator first. Afterwards, explore techniques for creating multiple independent streams: http://www.math.h.kyoto-u.ac.jp/~matumoto/RAND/DC/dc.html
Isn't that trivial if you follow the WH implementation strategy which stores all the state in a class instance? --Guido van Rossum (home page: http://www.python.org/~guido/)