This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sturlamolden
Recipients rhettinger, sturlamolden
Date 2011-08-16.00:22:01
SpamBayes Score 3.3325046e-05
Marked as misclassified No
Message-id <1313454125.14.0.832348714138.issue12754@psf.upfronthosting.co.za>
In-reply-to
Content
George Marsaglia's latest random number generator KISS4691 is worth considering, though I am not sure the performance is that different from MT19937. 

Here is a link to Marsaglia's post on comp.lang.c. Marasglia passed away shortly after (Feb. 2011), and to my knowledge a paper on KISS4691 was never published:

http://www.rhinocerus.net/forum/lang-c/620168-kiss4691-potentially-top-ranked-rng.html

On my laptop, KISS4691 could produce about 110 million random numbers per second (148 millon if inlined), whereas MT19937 produced 118 million random numbers per second. Another user on comp.lang.c reported that (with my benchmark) KISS4691 was about twice as fast as MT19937 on his computer. As for quality, I have been told that MT19937 only failes a couple of obscure tests for randomness, whereas KISS4691 failes no single-seed test.

The source code I used for this test is available here:

http://folk.uio.no/sturlamo/prngtest.zip

(Requires Windows because that's what I use, sorry, might work with winelib on Linux though.)

Marsaglia has previously recommended several PRNGs that are considerably simpler and faster than MT19937. These are the ones used in the 3rd edition of "Numerical Receipes" (yes I know that not a sign of good quality). We can look at them too, with Marsaglia's comments:

https://groups.google.com/group/sci.stat.math/msg/edcb117233979602?hl=en&pli=1

https://groups.google.com/group/sci.math.num-analysis/msg/eb4ddde782b17051?hl=en&pli=1

There are also SIMD-oriented versions of MT19937, though for licensing and portability reasons they might not be suitable for Python's standard library.

High-performance PRNGs are also present in the Intel MKL and AMD ACML libraries. These could be used if Python was linked against these libraries at build-time.

Regards,
Sturla Molden
History
Date User Action Args
2011-08-16 00:22:05sturlamoldensetrecipients: + sturlamolden, rhettinger
2011-08-16 00:22:05sturlamoldensetmessageid: <1313454125.14.0.832348714138.issue12754@psf.upfronthosting.co.za>
2011-08-16 00:22:04sturlamoldenlinkissue12754 messages
2011-08-16 00:22:01sturlamoldencreate