[Python-Dev] Mersenne Twister

Raymond Hettinger python@rcn.com
Thu, 29 Aug 2002 15:00:03 -0400


[Jeremy]
> Why not wrap the existing C implementation?  I think a wrapper has two
> advantages.  We get to reuse the existing implementation, without
> worry for transliteration errors.  We also get better performance.

On the plus side, it gives a chance to write a pure C helper 
function for creating many random numbers at a time.

On the minus side, random number generation is a much disputed
topic, occassionly requiring full disclosure of seeds and source.
Having the code in random.py makes it more visible than
burying it in the C code.

The C code I saw is covered by a BSD license -- I don't 
know if that's an issue or not.

As for implementation difficulty or accuracy, the code is so short 
and clear that there isn't a savings from re-using the C code.


Raymond