借助numpy.random.standard_normal()方法,我们可以从标准正态分布中获取随机样本,并使用此方法将随机样本作为numpy数组返回。
用法:numpy.random.standard_normal(size=None)
Return:以numpy数组形式返回随机样本。
范例1:
在此示例中,我们可以看到,通过使用numpy.random.standard_normal()方法,我们能够获得标准正态分布的随机样本。
Python3
# import numpy 
import numpy as np 
import matplotlib.pyplot as plt 
  
# Using standard_normal() method 
gfg = np.random.standard_normal(5000) 
  
plt.hist(gfg, bins = 50, density = True) 
plt.show()输出:
范例2:
Python3
# import numpy 
import numpy as np 
import matplotlib.pyplot as plt 
  
# Using standard_normal() method 
gfg = np.random.standard_normal(10000) 
  
plt.hist(gfg, bins = 100, density = True) 
plt.show()输出:
相关用法
- Python numpy.std()用法及代码示例
 - Python numpy.mean()用法及代码示例
 - Python numpy.irr()用法及代码示例
 - Python numpy.lcm()用法及代码示例
 - Python numpy.gcd()用法及代码示例
 - Python numpy.pmt()用法及代码示例
 - Python numpy.sum()用法及代码示例
 - Python numpy.inner()用法及代码示例
 - Python numpy.var()用法及代码示例
 - Python numpy.around()用法及代码示例
 - Python numpy.tan()用法及代码示例
 - Python numpy.cos()用法及代码示例
 - Python numpy.sin()用法及代码示例
 - Python numpy.mod()用法及代码示例
 - Python numpy.exp()用法及代码示例
 - Python numpy.log()用法及代码示例
 - Python numpy.fix()用法及代码示例
 - Python numpy.pv()用法及代码示例
 - Python numpy.fv()用法及代码示例
 - Python numpy.npv()用法及代码示例
 
注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 numpy.random.standard_normal() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。


