random.choice( list or array) 函数: 在list 或者 array中取一个数。
In [1]: np.random.choice([1,2,3,4,5]) #随机选一个数字
Out [1]: 2
In [2]: np.random.choice([1,2,3,4,5]) #随机选一个数字
Out [2]: 4
In [3]: np.random.choice((1,2,3,4,5)) #随机选一个数字
Out [3]: 1
In [4]: np.random.choice((1,2,3,4,5)) #随机选一个数字
Out [4]: 3