numpy / 1.21.4 / 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' ehU2SZ¿¤'  # random

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