Example 1: numpy random int
np.random.randint(2, size=10)
np.random.randint(5, size=10)
np.random.randint(5, size=(2, 4))
Example 2: generate random integer matrix python
import numpy as np
randi_arr = np.random.randint(start, end, dimensions)
Example 3: numpy randint
>>> np.random.randint(2, size=10)
array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0])
>>> np.random.randint(1, size=10)
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
Example 4: np.rand.randint
np.random.randint(0,10, size=(5, 5))
array([[3, 9, 2, 3, 5],
[2, 8, 7, 7, 1],
[8, 2, 1, 1, 9],
[9, 0, 5, 6, 4],
[1, 6, 6, 4, 6]])
Example 5: np.random.randn()
>>> 2.5 * np.random.randn(2, 4) + 3
array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677],
[ 0.39924804, 4.68456316, 4.99394529, 4.84057254]])