Python and crypto-strength random numbers by default
Python and crypto-strength random numbers by default
Posted Sep 17, 2015 12:12 UTC (Thu) by ianmcc (subscriber, #88379)Parent article: Python and crypto-strength random numbers by default
For numerical applications (Monte Carlo) you want deterministic random numbers, but seeded non-deterministically (but with the seed stashed away somewhere, so that you can reproduce the calculation later if necessary).
For a game, it would vary - if its a networked multiplayer game then you may well want it to be deterministic, so that multiple clients can do the same 'dice rolls' and stay in sync. If its an online poker game then you definitely want it to be non-deterministic (but you'd probably get the random numbers from a server somewhere anyway).
In all of these cases you'd want to choose very carefully the random number generator and how its used. No 'default' generator will cover all of these cases. The default generator should only be used for 'throwaway' applications, where you need some randomness but don't care whether its deterministic or secure, as long as it meets some minimum level of quality. And for that, MT is already overkill.