[SciPy-dev] random.set_state also in need of EXPERT attention

Pauli Virtanen pav+sp@iki...
Tue Jul 28 16:44:07 CDT 2009


(Disclaimer: I'm not a PRNG expert.)

On 2009-07-28, David Goldsmith <d_l_goldsmith@yahoo.com> wrote:
> Hi, folks!  Ralf originally requested expert attention for this 
> in its Discussion section; I over-confidently said I thought I 
> could handle it; after too many hours of unproductive research 
> (I seem to have found that there's a lot of "politics" in the 
> field of random number generators? 

Looks like science as usual to me :) I think the natural 
explanation is that everyone proposing a new PRNG of course wants 
to advertise its merits. Also, as there is no clear-cut way to 
quantify the "randomness" of a PRNG and because of speed 
tradeoffs, there is something to argue about and many different 
alternatives have been proposed.

> Despite widespread use: 
> http://en.wikipedia.org/wiki/Mersenne_twister, Matsumoto & 
> Nishimura and this algorithm don't appear to have much 
> recognition in certain circles, e.g., those under the influence 
> of Marsaglia, e.g., notably, "Numerical Recipes."

The second edition of Numerical recipes was written in 1992, so 
that explains why it's not there.

If you Google it, for the third edition the authors of NR respond 
[1] that they didn't include MT because it "has just too many 
operations per random value generated". This is of course 
understandable in a book that aims to give a focused introduction 
on the subject. Whether it reflects the merits of the algorithm 
is then a different question.

.. [1] http://www.nr.com/forum/showthread.php?t=1724

> I understand that Marsaglia is critical of MT, but for "NR" to 
> completely ignore an algorithm in such widespread use, well, 
> out of curiosity, if anyone knows, "what gives"?)

As I see it, the statements sourced in the Wikipedia article are 
fairly mild, criticising mostly the complexity of the algorithm. 
Also, they were not backed by anything, and probably should be 
taken with a grain of salt.

Marsaglia seems to have proposed another types of PRNGs in 2003, 
but these had flaws, which maybe were addressed by Brent later 
on. (Cf. [2] and follow the references.)

The MT article is widely cited (123 citations as reported by ACM, 
1346 by Google Scholar), and sampling some of the review-type 
ones (eg. [3,4]) the generator seems to have done reasonably in 
various randomness tests and also be reasonable speed-wise. 
Perhaps the algorithm is not optimal -- after all, it's already 
more than ten years old -- but it appears to be well tested and 
understood.

.. [2] http://wwwmaths.anu.edu.au/~brent/random.html
.. [3] http://dx.doi.org/10.1016/j.csda.2006.05.019
.. [4] http://www.iro.umontreal.ca/~simardr/testu01/tu01.html

-- 
Pauli Virtanen



More information about the Scipy-dev mailing list