python – SystemRandom提供哪些平台?
作者:互联网
Python的random.SystemRandom提供加密质量的伪随机数.它支持哪些平台?最重要的是,是否存在任何不受支持的平台,如果有,哪些平台?任何人都可以提供有关便携性的任何信息吗?
解决方法:
从http://docs.python.org/library/random.html起
The random module also provides the
SystemRandom
class which uses the system functionos.urandom()
to generate random numbers from sources provided by the operating system.
从http://docs.python.org/library/os.html#os.urandom开始
This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. On a UNIX-like system this will query
/dev/urandom
, and on Windows it will useCryptGenRandom
. If a randomness source is not found,NotImplementedError
will be raised.
标签:python,random,cryptography,portability,prng 来源: https://codeday.me/bug/20190626/1295751.html