I am new to both stats and scientific Python, so apologies if this question breaches any guidelines.

I want to know what x = np.random.randn(500) actually does, in terms I can understand. Why exactly does plotting x give values in the range shown in this image:

enter image description here


It looks like the values range roughly from -3 to 3, yet I can find no mention of the range in documentation for numpy.random.randn. Therefore I'm assuming this property must somehow be intrinsic to a standard normal distribution, but I don't have enough knowledge of this entity to understand why.

Is it possible, although wildly improbable, that values with a much greater magnitude could be generated? Is it a feature of the specific implementation that the values range from -3 to +3 ish, rather than, say, -10 to +10 ish?

  • 1
    $\begingroup$ randn simply generates pseudo-random numbers from the standard normal distribution (en.wikipedia.org/wiki/…). The values are unbound, but very large and very small values are highly improbable. $\endgroup$
    – Igor F.
    Commented Jan 25, 2021 at 15:37

1 Answer 1


Correct, it is possible but wildly improbable. Theoretically, any value is possible but 99.7% of standard normal random variables are between -3 and +3. Only 1 in a billion will be larger than 6 (or less than -6).

  • $\begingroup$ I'm still a bit confused though. Why is the range not -30 to +30 or -300 to +300? How does the standard normal distribution "know" what range comprises 1,2 or 3 standard deviations, when no actual values are specified? $\endgroup$ Commented Jan 27, 2021 at 9:53
  • $\begingroup$ That's what a distribution does. It specifies precisely the probability that X can be less than -3, greater than 4, etc. This particular distribution just has the property that almost all values are between -3 and 3. There are other distributions that can have large values. For example, normal with mean 0 and variance 100. Now, most of the values will be between -30 and 30 and you will often see numbers like 10.5583, -21.444421, etc. $\endgroup$
    – John L
    Commented Jan 28, 2021 at 0:39
  • $\begingroup$ So there is an implicit variance of 10 in the values produced by the function? $\endgroup$ Commented Jan 28, 2021 at 20:17
  • $\begingroup$ No: by definition, the variance is $1.$ $\endgroup$
    – whuber
    Commented May 18, 2022 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.