random.randbytes

Full name
random.randbytes
Library
random
Syntax

random.randbytes(n)

Description

The random.randbytes function generates random bytes.

Parameters
  • n: Number of bytes to generate.
Result

The random.randbytes function returns a value of type bytes .

Examples

We can generate three random bytes with the following code:

random.randbytes(3)
b '\x17bu'
Submitted by admin on Tue, 02/23/2021 - 09:26