![在这里插入图片描述](https://img-blog.csdnimg.cn/20191113112715810.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L01yX0NhdDEyMw==,size_16,color_FFFFFF,t_70)
这里只列出重要的几个函数
生成随机整数–离散均匀分布
使用numpy.random.randint(low, high=None, size=None, dtype=‘I’),范围为[low,high),不包括high这个值。生成的是离散的均匀分布(“discrete uniform” distribution)
使用numpy.random.random_integers(low, high=None, size=None, dtype=‘I’),范围为[low,high],包括high这个值。但是,这个函数已经被取消了,可以使用上面提到的randint函数,将high+1即可。
生成随机浮点数–连续型均匀分布
使用numpy.random.uniform(low=0.0, high=1.0, size=None)
这个得到的是均分布的浮点数,取值范围为[low, high),默认取值范围为[0, 1.0)
生成[0,1)之间的均匀分布
numpy.random.rand(d0, d1, …, dn),生成[0,1)之间的均匀分布
生成标准正太分布
numpy.random.randn(d0, d1, …, dn)
Return a sample (or samples) from the “standard normal” distribution.
高斯/正太分布
random.normal默认均值为0,方差为1.这两个值也可以自己设定