[Python-Dev] Time for a change of random number generator?
Robert Kern
robert.kern at gmail.com
Thu Feb 11 06:57:45 EST 2016
On 2016-02-11 00:08, Greg Ewing wrote:
> The Mersenne Twister is no longer regarded as quite state-of-the art
> because it can get into states that produce long sequences that are
> not very random.
>
> There is a variation on MT called WELL that has better properties
> in this regard. Does anyone think it would be a good idea to replace
> MT with WELL as Python's default rng?
>
> https://en.wikipedia.org/wiki/Well_equidistributed_long-period_linear
There was a side-discussion about this during the secrets module proposal
discussion.
WELL would not be my first choice. It escapes the excess-0 islands faster than
MT, but still suffers from them. More troubling to me is that it is a linear
feedback shift register, like MT, and all LFSRs quickly fail the linear
complexity test in BigCrush.
xorshift* shares some of these flaws, but is significantly stronger and
dominates WELL in most (all?) relevant dimensions.
http://xorshift.di.unimi.it/
I'm favorable to the PCG family these days, though xorshift* and Random123 are
reasonable alternatives.
http://www.pcg-random.org/
https://www.deshawresearch.com/resources_random123.html
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-Dev
mailing list