On Fri, Jul 9, 2021 at 2:26 PM Tim Peters
[Ethan Furman]
A question [1] has arisen about the viability of `random.SystemRandom` in Pythons before and after the secrets module was introduced (3.5 I think) -- specifically
does it give independent and uniform discrete distribution for cryptographic purposes across CPython 3.x versions?
`secrets` is just a wrapper around `random.SystemRandom`, so the presence or absence of `secrets` doesn't matter.
As to SystemRandom, all answers depend on the quality of the platform os.urandom(), which Python has no control over. See my answer here, and the comments on it:
https://stackoverflow.com/questions/20936993/how-can-i-create-a-random-numbe...
It looks like CPython could do better on Windows: SystemRandom (because of os.urandom()) is good on Linux and mac, but on Windows they use the CryptGenRandom deprecated API.... Supporting detail: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryp... Should I open an issue?