Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What platforms offer SystemRandom?

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?

like image 555
D.W. Avatar asked Oct 10 '22 20:10

D.W.


1 Answers

From http://docs.python.org/library/random.html

The random module also provides the SystemRandom class which uses the system function os.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 use CryptGenRandom. If a randomness source is not found, NotImplementedError will be raised.

like image 169
tylerl Avatar answered Oct 14 '22 02:10

tylerl