NumPy array random



examples/numpy/array_random.py
import numpy as np

a = np.random.random((2, 5))  # in the range [0.0, 1.0)
print(a)
print()

rng = np.random.default_rng()
b = rng.random(size=(3, 4))
print(b)

[[0.32151126 0.07688622 0.95666894 0.42396291 0.93592235]
 [0.71406863 0.95152079 0.20199695 0.72628099 0.33545885]]

[[0.46643834 0.71350899 0.40279583 0.85148985]
 [0.19367868 0.53288449 0.97181597 0.86311691]
 [0.70687485 0.78534671 0.16654183 0.9371896 ]]