参考资料:用python动手学统计学,帮助文档
方法1:scipy.stats.norm.rvs()
python
from scipy import stats
stats.norm.rvs(loc=4,scale=0.8,size=10)
参数介绍如下:
loc:表示正态分布的均值,默认为0
scale:表示正态分布的标准差,默认为1
size:表示抽样的数据,可以是数值可以是元组。数值和元组的效果如下:


方法2:numpy.random.normal()
python
import numpy as np
np.random.normal(loc=4,scale=0.8,size=10)
其参数设置同方法1。