- random
- default_rng
- randint
- integer
NumPy Random integers
examples/numpy/random_integers.py
import numpy as np a = np.random.randint(10, size=(3, 4)) print(a) rng = np.random.default_rng() b = rng.integers(42, size=(3, 4)) print(b)
[[1 2 2 6] [2 2 9 8] [8 8 9 5]] [[13 31 7 11] [22 2 6 18] [24 10 12 0]]