[Python-ideas] Should our default random number generator be secure?

Sturla Molden sturla.molden at gmail.com
Tue Sep 15 14:51:28 CEST 2015


On 10/09/15 04:23, Tim Peters wrote:

>  Now (well, last I
> saw) they recommend a parameterized scheme creating a distinct variant
> of MT per thread (not just different state, but a different (albeit
> related) algorithm)

The DCMT use the same algorithm (Mersenne Twister) but with different 
polynomials. The choice of polynomial is more or less arbitrary. You can 
search for a set of N polynomials that are (almost) prime to each other, 
and thus end up with totally independent sequences. Searching for such a 
set can take some time, so you need to do that in advance and save the 
result. But once you have a set, each one of them is just as valid as 
the vanilla MT.

PCG also provides independent streams.


Sturla



More information about the Python-ideas mailing list