pyplot.hist(np.random.randn(1000000), bins=np.linspace(-4, 4, 200));
The function call randn
gives you 1 million samples from the standard normal distribution (mean = 0, standard deviation = 1). linspace
divides the interval -4 to 4 to 201 points (which means 200 equally spaced interval). Lastly, hist
plots the histogram. Any values below -4 or above 4 is ignored.