On 14/09/15 10:34, Antoine Pitrou wrote:

Currently we don't provide those APIs on the GPU, since MT is much too
costly there.

If Numpy wanted to switch to a different generator, and if Numba wanted
to remain compatible with Numpy, one of the PCG functions would be an
excellent choice (also for CPU performance, incidentally).

We have discussed allowing plugable PRNGs in NumPy on multiple occations.

I don't think NumPy should change its default PRNG. The Mersenne Twister MT19937 is state of the art of numerical work. It has excellent numerical accuracy, a huge period, and is very fast. For most users of NumPy, the MT19937 is the first and last word that needs to be said about pseudorandom number generators. We have the default that most users of NumPy will ever want, unless severe flaws are discovered in the algorithm (not very likely).

But there are occations where it does not work well. For example for parallel simulations it is (sometimes) nice to use DCMT instead of a vanilla MT19937. There are a lot of other generators that NumPy should consider as well, including the one you mention and Marsaglia's generators. We need to refactor randomkit to use a plugable entropy source instead of its internal MT19937. This is actually very easy to implement. In that case a user could just provide a Cython class or callback function (C, Fortran or Python) for generating a random ulong32.

The discussion on python-ideas refers to cryptography. That is not equally relevant for NumPy. But with a plugable design we can let NumPy users use os.urandom as well.


Sturla


_______________________________________________
NumPy-Discussion mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to