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

Petr Viktorin encukou at gmail.com
Wed Sep 9 22:37:55 CEST 2015

On Wed, Sep 9, 2015 at 9:33 PM, Stefan Krah <skrah at bytereef.org> wrote:
> Steven D'Aprano <steve at ...> writes:
>> Question, aimed at anyone, not necessarily random832 -- one desirable
>> property of PRNGs is that you can repeat a sequence of values if you
>> re-seed with a known value. Does arc4random keep that property? I think
>> that it is important that the default RNG be deterministic when given a
>> known seed. (I'm happy for the default seed to be unpredictable.)

The OpenBSD implementation does not allow any kind of reproducible results.
Reading http://www.pcg-random.org/other-rngs.html, I see that
arc4random is not built for is statistical quality and k-dimensional
equidistribution, which are also properties you might not need for
crypto, but do want for simulations.
So there are two quite different use cases (plus a lot of grey area
where any solution is okay).

The current situation may be surprising to people who didn't read the
docs. Switching away from MT might be a disservice to users that did
read and understand them.

More information about the Python-ideas mailing list