PyDocs

Nav

Generic Operating System Services

urandom

os

function
  • urandom(size, /)
Return a bytes object containing random bytes suitable for cryptographic use.
Changed in 3.5, 3.5.2, 3.6, 3.11
  • 3.5: On Linux 3.17 and newer, the getrandom() syscall is now used when available. On OpenBSD 5.6 and newer, the C getentropy() function is now used. These functions avoid the usage of an internal file descriptor.
  • 3.5.2: On Linux, if the getrandom() syscall blocks (the urandom entropy pool is not initialized yet), fall back on reading /dev/urandom.
  • 3.6: On Linux, getrandom() is now used in blocking mode to increase the security.
  • 3.11: On Windows, BCryptGenRandom() is used instead of CryptGenRandom() which is deprecated.
0 Examples
No examples for os/urandom.
See Also
No see-alsos for os/urandom
0 Notes
No notes for urandom