lundi 2 août 2021

Python: Generate normally distributed Integers in a range

I would like to generate a vector of random integers in a range [1,101) that is Normally Distributed using Python and I'm not sure what is the best way to do it. I've tried the following but feel that there should be a better way:

mu, sigma = df_samples['fitness'].mean(), df_samples['fitness'].std()
print(mu, sigma)
## 51.767 29.18212307744773

draw = np.abs(np.random.normal(mu, sigma, size=1000))
plt.hist((draw/draw.max())*100, alpha=0.5, bins=20);



Aucun commentaire:

Enregistrer un commentaire