[Numpy-discussion] additions to random: innovative names vs. algorithm specification

Sturla Molden sturla at molden.no
Sat Jul 31 18:59:57 EDT 2010


> On Thu, Jul 29, 2010 at 19:26, Sturla Molden <sturla at molden.no> wrote:

>> http://groups.google.com/group/sci.math/msg/dc9ad178113a30fd
>
> It looks like it has a little bit more peer review to get through, but
> thanks for the pointer! That's probably the best motivation I've seen
> to do the refactoring of the numpy.random code to allow multiple core
> PRNGs.

Mersenne Twister is over 10 years old, and a well tried algorithm.
KISS4691 is to my knowledge a week old, and only published on a newsgroup
(not in a peer reviewed paper, though the author is among the world's
foremost authorities on random numbers.) KISS4691 advantage over MT19937
is speed and simplicity, but we cannot put an algorithm this new into
NumPy. It still needs a lot of testing. I just thought your comment on
sampling algorithms not invented "all that often" was a bit funny a week
after Marsaglia described KISS4691. :-)

But ziggurat and random bit generators are different matters. Ziggurat can
use KISS4691, MT19937 or any random bit generator to sample arbitrary
distributions in [0,inf) or symmetric distributions in (inf,inf). I wonder
if we should consider a general ziggurat sampler for SciPy or NumPy. It
could take two arguments: a PDF expression (e.g. lambda function) and a
fallback for the tail (prng or ufunc transform). We could use numeric
integration to set up the ziggurat table, and amortize the Python overhead
for the tail fallback. The other option would be specialized ziggurat
generators for common distributions (e.g. standard normal, exponential and
gamma).


Sturla












More information about the NumPy-Discussion mailing list