import numpy as np
a1 = np.random.choice(7,5)
a1
array([6, 2, 3, 5, 2])
a2 = np.random.choice([0,1,2,3,4,5,6],5)
a2
array([0, 6, 0, 6, 5])
a3 = np.random.choice(np.array([0,1,2,3,4,5,6]),5)
a3
array([5, 5, 3, 3, 6])
a4 = np.random.choice([0,1,2,3,4,5,6],5,replace=False)
a4
array([1, 0, 2, 5, 4])
a5 = np.random.choice(np.array([0,1,2,3,4,5,6]),5,p=[0.1,0.1,0.1,0.1,0.1,0.1,0.4])
a5
array([6, 5, 5, 0, 6])