numpy / 1.22.0 / reference / random / generated / numpy.random.generator.bytes.html /

numpy.random.Generator.bytes

method

random.Generator. bytes ( length )

Return random bytes.

Parameters
length int

Number of random bytes.

Returns
out bytes

String of length length.

Examples

>>> np.random.default_rng().bytes(10)
b'\xfeC\x9b\x86\x17\xf2\xa1\xafcp' # random

© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.22/reference/random/generated/numpy.random.Generator.bytes.html