Take the 2-minute tour ×

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?

share|improve this question
add comment

1 Answer

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


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.

share|improve this answer
And on VMS, it uses OpenSSL's RAND_pseudo_bytes, as you can see by reading the source. –  Nemo Jun 2 '11 at 19:30
@tylerl, yeah, I already read the docs, and I already knew it is supported on Windows and on Unix platforms that have /dev/urandom. But again, I'm most interested in knowing which platforms it is not supported on, as mentioned in the original question. –  D.W. Jun 3 '11 at 0:31
@Nemo, thanks, that is useful! –  D.W. Jun 3 '11 at 0:31
I could just sense you are using VMS –  Nemo Jun 3 '11 at 0:55
From what I understand, RAND_psuedo_bytes is similar to /dev/urandom on linux, as it uses an acquired entropy pool for true randomness, but re-uses entropy to avoid blocking. –  tylerl Jun 3 '11 at 14:54
show 3 more comments

Your Answer


