[Numpy-discussion] Random number generators

A. M. Archibald peridot.faceted at gmail.com
Mon Sep 4 01:34:28 EDT 2006


On 04/09/06, Charles R Harris <charlesr.harris at gmail.com> wrote:

> Except for the last, none conflict with current routines and can be added
> without a branch. I expect adding MWC8222 might need more extensive work and
> I will branch for that. So the questions are of utility and naming. I see
> some utility for myself, otherwise I wouldn't be considering doing the work.
> OTOH, I already have (C++) routines that I use for these things, so a larger
> question might be if anyone else sees a use for these. I like speed, but it
> is not always that important in everyday apps.

How painful would it be to allow users to drop in their own sources of
raw random numbers? A couple of years ago I was trying to analyze some
X-ray timing data and we saw some peaks at the end of a long chain of
periodicity-detecting software (Fourier transforms, parameter
searching, et cetera). To rule out the possibility that they were
coming from the random numbers we were using at one stage, I wanted to
supply raw random numbers from /dev/random. Unfortunately, that forced
me to write my own program to convert uniform random numbers to
exponential. Allowing the function that generates raw random bytes to
be overwritten would be extremely handy, even if it were painfully
slow.

In the same project I also noticed it would be nice to be able to
(say) do "exponential(2+sin(arange(10)))" to get an array of
exponentials with varying parameters.

I realize all this is outside the scope of what you were asking. I
would have found another pseudorandom number generator that I could
just switch to a benefit; the rest of them are less exciting.

When you say "32-bit integers" do you really mean 32-bit, or do you
mean "machine width"? 32-bit integers may not be faster on 64-bit
platforms...

A. M. Archibald




More information about the NumPy-Discussion mailing list