[SciPy-dev] Re: [Numpy-discussion] Release of scipy core betawill happen next week.

Robert Kern rkern at ucsd.edu
Tue Sep 27 14:54:49 CDT 2005

Charles Harris wrote:
>>I also have mtrand ready to go in. It isn't entirely plug-compatible
>>with RandomArray or RNG, but I think that it's clearly superior and
>>should be the *single* default PRNG in scipy_core (I emphasize *single*
>>because scipy.stats.ranf() is using one generator and the other
>>distributions are using another. This is not good.).
> I assume mtrand is the Mersenne Twister. The Python module Random also
> uses the MT generator now. Did you look into that implementation by any chance?

I'm using RandomKit by Jean-Sebastian Roy. Ultimately, the core
algorithm in both implementations are cut-and-pasted from the reference
implementation. I picked RandomKit because I could drop it in directly
with minimal change. It passes around state in a plain C struct rather
than a PyObject*, which is good, because I needed to extend that struct.
RandomKit also has a nice feature that the stdlib implementation
doesn't: if /dev/urandom is available (or the equivalent Windows API),
RandomKit will use that to seed itself instead of the time if it wasn't
given an explicit seed to begin with. When you have 624 words of state,
it's good to use them all.


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-dev mailing list