np.random namespace and use the global MT19937 generator. Seed with np.random.seed() for reproducible results.
random
Generate random floats in the half-open interval[0.0, 1.0).
Returns:
NDArray | number — Random values in [0, 1).
rand
Random values in a given shape. Variadic form ofrandom — pass dimensions as separate arguments.
Returns:
NDArray | number — Random values in [0, 1).
randn
Return samples from the standard normal distribution (mean=0, std=1). Variadic shape, likerand.
Returns:
NDArray | number — Samples from the standard normal distribution.
randint
Return random integers fromlow (inclusive) to high (exclusive).
Returns:
NDArray | number — Random integers in [low, high).
random_sample
Alias forrandom(). Return random floats in [0.0, 1.0).
Returns:
NDArray | number — Random values in [0, 1).
ranf
Alias forrandom(). Return random floats in [0.0, 1.0).
Returns:
NDArray | number — Random values in [0, 1).
sample
Alias forrandom(). Return random floats in [0.0, 1.0).
Returns:
NDArray | number — Random values in [0, 1).
random_integers
Return random integers betweenlow and high, inclusive on both ends.
Returns:
NDArray | number — Random integers in [low, high].
bytes
Return random bytes as aUint8Array.
Returns:
Uint8Array — Array of random bytes.
choice
Generate a random sample from a given 1-D array or fromrange(a) when a is an integer.