[SciPy-user] Mersenne Twister PRNG

Robert Kern rkern at ucsd.edu
Tue Sep 6 23:20:14 CDT 2005

skip at pobox.com wrote:
>     Robert> AFAICT, _random doesn't expose a C API.
> It shouldn't be hard to add.  Take a look at how it's done for the datetime
> module (PyDateTime_CAPI struct, PyDateTime_IMPORT macro, etc).

Sure, and I might do just that later. However, the PRNG in scipy really
needs to be updated before Python 2.5 will be released or widely adopted.

In any case, the amount of code duplication is small, just the MT19937
algorithm and initialization code which is tiny and from the same
reference implementation. I don't think anyone would derive much benefit
from our using the exported version.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the SciPy-user mailing list