This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / random / _generator / Generator / bytes

cython_function_or_method

numpy.random._generator:Generator.bytes

Signature

def   bytes ( length )

Summary

Return random bytes.

Parameters

length : int

Number of random bytes.

Returns

out : bytes

String of length length.

Notes

This function generates random bytes from a discrete uniform distribution. The generated bytes are independent from the CPU's native endianness.

Examples

rng = np.random.default_rng()
rng.bytes(10)

Aliases

  • numpy.random.Generator.bytes

Referenced by