As a complement to the comments and example above, the documentation is in my numpy implementation.
In abbreviated form with large legs:
help(np.random.normal) normal(loc=0.0, scale=1.0, size=None) Draw random samples from a normal (Gaussian) distribution. Parameters
If you want to create a series of data values โโwith a specific shape, oriented by the average value with a given standard deviation, you can do the following.
>>> x = 10 >>> vals = np.random.normal(x,3.,(10,)) >>> vals array([ 10.6999745 , 9.58139692, 14.04490407, 9.54797132, 10.18378835, 11.42772729, 5.22100578, 9.51757533, 12.95314676, 13.77068901])
which generates an array of 10 values, form (10) with an average value of 10 and values โโscattered within ยฑ 3 standard deviations. The actual distribution function, links, and matplotlib sample code are also presented. I am using np.version.version '1.8.0'.
This is a useful feature if you want to create point patterns (X, Y) centered around the mean with a known spread.
user1121588
source share