2.6. Random Byte Generator

We provide a high-entropy source of randomness, which you can use to securely generate random byte strings. For example, you may use crypto.SecureRandom to generate symmetric keys or initialization vectors for Symmetric Encryption.

2.6.1. Functions

crypto.SecureRandom(num_bytes: int) bytes

Given a length num_bytes, randomly generates that many bytes from a secure source of entropy.

Parameters:

num_bytes (int) – The number of bytes to generate

Returns:

The random bytes

Return type:

bytes