import numpy as np
a = np.random.rand(3,4,5)
a
array([[[0.03981108, 0.91836382, 0.92710838, 0.65510134, 0.97955925],
[0.15451978, 0.14722667, 0.37221513, 0.03603127, 0.82707464],
[0.07324249, 0.2454074 , 0.23851544, 0.6538309 , 0.5093643 ],
[0.45440818, 0.73074743, 0.71777944, 0.28868269, 0.2554641 ]],
[[0.95907571, 0.41810704, 0.84569667, 0.74927957, 0.51916659],
[0.23335913, 0.53471954, 0.83018152, 0.05219839, 0.73114234],
[0.2076154 , 0.0956393 , 0.14043027, 0.61894813, 0.47763035],
[0.51753088, 0.23452011, 0.09563357, 0.32338085, 0.91953517]],
[[0.92725234, 0.44382386, 0.15047355, 0.04683946, 0.24610117],
[0.32001386, 0.37629394, 0.78809439, 0.7295746 , 0.9276709 ],
[0.95345769, 0.47610291, 0.75445707, 0.75307577, 0.95782705],
[0.4752363 , 0.19925779, 0.53362318, 0.86523423, 0.66311092]]])
b = np.random.randint(100,120,(3,4))
b
array([[113, 116, 113, 103],
[105, 104, 101, 109],
[104, 116, 115, 116]])
np.random.permutation(b)
array([[105, 104, 101, 109],
[113, 116, 113, 103],
[104, 116, 115, 116]])
1. normal(iow,high,size) 正态分布,low起始值,high结束值,size形状
2. uniform(loc,scale,size) 均匀分布,loc均值,scale标准差,size形状
3. poisson(lam,size) 泊松分布,lam随机事件发生率,size形状
c = np.random.normal(10,5,(3,4))
c
array([[ 8.55534476, 9.48111564, 12.08945918, 9.48659342],
[ 8.46447183, 17.72147327, 9.77816149, 4.90556247],
[12.63948457, 7.8163882 , 9.23039568, 8.40635744]])
由于是在jupyter notebook中写好的笔记然后再上传到本博客上,所以代码都是按照输入与输出的顺序来的,都是可以运行出来的,如果又不懂的地方,欢迎提问