[Python-Dev] Time for a change of random number generator?

Steven D'Aprano steve at pearwood.info
Thu Feb 11 04:39:05 EST 2016


On Thu, Feb 11, 2016 at 01:08:41PM +1300, 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

I'm not able to judge the claims about which PRNG is better (perhaps Tim 
Peters has an opinion?) but if we do change, I'd like to see the 
existing random.Random moved to random.MT_Random for backwards 
compatibility and compatibility with other software which uses MT. Not 
necessarily saying that we have to keep it around forever (after all, we 
did dump the Wichmann-Hill PRNG some time ago) but we ought to keep it 
for at least a couple of releases.


-- 
Steve


More information about the Python-Dev mailing list