[Numpy-discussion] Random number generators
A. M. Archibald
peridot.faceted at gmail.com
Mon Sep 4 13:17:23 CDT 2006
On 04/09/06, Charles R Harris <charlesr.harris at gmail.com> wrote:
> On 9/4/06, A. M. Archibald <peridot.faceted at gmail.com> wrote:
> > On 04/09/06, Robert Kern <robert.kern at gmail.com> wrote:
> > > Charles R Harris wrote:
> > However, a random number generator based on a stream cipher is
> > probably going to be pretty good, if slow, so implementingone if those
> > can't hurt. But I think leaving the possibility open that one could
> > use custom sources of random bytes is a very good idea. There's no
> > particular need that custom ones should be fast, as they're for use
> > when you really want *good* random numbers.
> I was thinking it might be nice to have one, just to generate seeds if
> nothing else. This could actually be written in python and use something
> like the python cryptography toolkit, no need to reinvent the wheel. It
> might be worth looking at that code just to see how someone else thought
> through the interface. It's under the Python license, so I need to know if
> that license is compatible with the BSD license used for numpy.
Of the generators they have, only their random pool is of any use for
seeding, and even that needs some clever feeding of random data.
However, on practically any platofrm this will run on, random bytes
based on real entropy can be extracted from the system (/dev/random,
windows crypto API, something on the Mac); a uniform API for those
would be a handy thing to have. But I can't recommend spending much
effort connecting the python crypto stuff to numpy's random number
generators; it's the sort of thing application writers can easily cook
up by subclassing RandomGenerator (or whatever).
A. M. Archibald
More information about the Numpy-discussion