numpy.random.rand(m,n,p,q…) 生成0到1之间的n个随机数,参数是shape #传入单个参数 import numpy as np data=np.random.rand(3) print(data) 输出: [0.42487743 0.92537519 0.53686567] #传入两个参数:输出一个值在0-1之间的三行四列数组 import numpy as np data=np.random.rand(3,4) print(data) 输出: [[0.98377973 0.85092775 0.7504745 0.14616559] [0.82135553 0.47096988 0.43921536 0.52325622] [0.25834071 0.3646412 0.88872318 0.24679017]] numpy.random.randn(d0,d1,d2)从标准正态分布中返回一个或多个样本,参数是shape import numpy data=numpy.random.randn(3,4) print(data) 输出: [[-1.00371958 1.47718184 0.70418891 0.84347875] [-0.34671091 1.20209922 -1.49002216 1.58234722] [-0.05994912 0.08149479 -1.10874929 -0.88186209]] numpy.random.randint(m,n,size)([m,n))左闭右开 import numpy data=numpy.random.randint(1,100,