mercredi 20 janvier 2016

non-random sampling versions of np.random.normal

I'm trying to generate a single array that follows an exact gaussian distribution. np.random.normal sort of does this by randomly sampling from a gaussian, but how can I reproduce and exact gaussian given some mean and sigma. So the array would produce a histogram that follows an exact gaussian, not just an approximate gaussian as shown below.

mu, sigma = 10, 1
s = np.random.normal(mu, sigma, 1000)

fig = figure()
ax = plt.axes()

totaln, bbins, patches = ax.hist(s, 10, normed = 1, histtype = 'stepfilled', linewidth = 1.2)

plt.show()




Aucun commentaire:

Enregistrer un commentaire