Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Mersenne-Twister approach should certainly not be studied anymore, even if some popular old libraries still use it. It fell long out of favor, is too slow, and not good enough.

Modern PRNG's can be tested with Dieharder, TestU01 or STS and benchmarked. This article only talks about primitive old LCG's (not any good one) or MT.



When you say Mersenne-Twister isn't good enough, what are the other shortcomings apart from speed? It seems that even modern versions of Python are continuing to use it...


Its slow, large, and statistically worse than modern PRNGs- and jumping ahead takes longer and a more complicated algorithm.

Even a truncated 128-bit LCG has far better properties.

See https://www.pcg-random.org/index.html

The homepage might come across as a a little overzealous (for example ChaCha quality listed as good rather than excellent), but generally has good points.


However, this page claims PCG is rather bad: http://pcg.di.unimi.it/pcg.php

They recommend to use their xoshiro PRNG.


That author has a history of extreme bias and almost-vindictive personal attacks on the author of PCG. See the reddit comments:

https://www.reddit.com/r/programming/comments/8jbkgy/the_wra...

And the PCG author's response: https://www.pcg-random.org/posts/on-vignas-pcg-critique.html

For example, for one of his arguments, he specifically chose a generator called pcg32_once_insecure, which the PCG author does not recommend due to its invertible output function!

Personally, I have read both arguments in detail and I would always use PCG or even a truncated LCG over xoshiro, which has a large size in comparison, potentially worse statistical properties, and no gain- faster in some benchmarks and slower in others.


Well, I had only skimmed the page

But I am using xoshiro in my projects, because I thought xor was simpler than multiplication.


Yeah, xor is simpler than multiplication in terms of hardware complexity- luckily, we have the multiplication circuits built in, so may as well take advantage of them.


Xoshiro ist only fast, nothing else. PCG has much better properties. Fast is not everything.

But there exist some new and very fast PRNG's which are fast and extremely good. Almost TRNG, wyrand eg.


Note, however, that it has an extremely large period which is a need for some specific applications (but I do agree that, for most use cases, it should be avoided).




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: