1np.random.randint(2, size=10) # Creates binary sample of size 10
2np.random.randint(5, size=10) # Creates sample with 0-4 as values of size 10
3
4np.random.randint(5, size=(2, 4))
1import numpy as np
2
3randi_arr = np.random.randint(start, end, dimensions)
4#random integers will be sampled from [start, end) (end not inclusive)
5#end is optional; if end is not specified, random integers will be sampled from [0, start) (start not inclusive)
6#dimensions can be specified as shown here; (m,n) #2D array with size 'm x n'
1>>> np.random.randint(2, size=10)
2array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0]) # random
3>>> np.random.randint(1, size=10)
4array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
1np.random.randint(0,10, size=(5, 5)) # random integers from 0 to 10 in size 5,5
2#o/p
3array([[3, 9, 2, 3, 5],
4 [2, 8, 7, 7, 1],
5 [8, 2, 1, 1, 9],
6 [9, 0, 5, 6, 4],
7 [1, 6, 6, 4, 6]])