问题
Python's random.SystemRandom
provides cryptographic-quality pseudorandom numbers. What platforms is it supported on? Most importantly, are there any platforms that it is not supported on, and if so, which ones? Can anyone provide any information about how portable it is?
回答1:
From 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.
From 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.
来源:https://stackoverflow.com/questions/6219254/what-platforms-offer-systemrandom