最直接的方式:用numpy.random模块来生成随机数组
1、np.random.rand 用于生成[0.0, 1.0)之间的随机浮点数, 当没有参数时,返回一个随机浮点数,当有一个参数时,返回该参数长度大小的一维随机浮点数数组...,参数建议是整数型,因为未来版本的numpy可能不支持非整形参数。...0.07145189, 2.89728643, 2.32095237, 1.12925633, -0.39210317])
3、np.random.randint(low[, high, size]) 返回随机的整数...np.random.randint(10,size=10)
array([4, 1, 4, 3, 8, 2, 8, 5, 8, 9])
4、random_integers(low[, high, size]) 返回随机的整数...random.uniform(9.9, 2)
5.189511116007191
4、random.randrange(start, stop, step) -> 返回以start开始,stop结束,step为步长的列表中的随机整数