小编Dri*_*ssi的帖子

Python:按铃声顺序生成正态分布

我想按照铃声的顺序生成正态分布。我使用此代码来生成数字:

import numpy as np

mu,sigma,n = 0.,1.,1000

def normal(x,mu,sigma):
    return ( 2.*np.pi*sigma**2. )**-.5 * np.exp( -.5 * (x-mu)**2. / sigma**2. )

x = np.random.normal(mu,sigma,n) #generate random list of points from normal distribution
y = normal(x,mu,sigma) #evaluate the probability density at each point
x,y = x[np.argsort(y)],np.sort(y) #sort according to the probability density
Run Code Online (Sandbox Code Playgroud)

这是中提出的代码:按顺序生成正态分布 python,numpy

但数字并不遵循钟形。有任何想法吗?非常感谢

python normal-distribution python-3.x

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

normal-distribution ×1

python ×1

python-3.x ×1