[Python-ideas] Globally configurable random number generation

Nick Coghlan ncoghlan at gmail.com
Tue Sep 15 05:22:27 CEST 2015

On 15 September 2015 at 12:30, Random832 <random832 at fastmail.com> wrote:
> Nick Coghlan <ncoghlan at gmail.com> writes:
>> Compared to my original proposal, the seedable MT RNG retains the
>> random.Random name, so any code already using explicit instances is
>> entirely unaffected by the proposed change.
> So, if you use random.Random() without seeding, you still get "MT seeded
> from os.urandom"?

Yes, with the revised proposal, only the module level functions would
change their behaviour to use a CSPRNG by default. If you trawl the
various cryptographically unsound password generation recipes, they're
almost all using the module level functions, so changing the meaning
of random.Random itself would add a lot of additional pain for next to
no gain.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list