Home > OS >  Is there a limit on how large a number np.random.normal(0, 1) can generate?
Is there a limit on how large a number np.random.normal(0, 1) can generate?

Time:10-02

So I'm basically wondering if it would be possible for RNG to generate a number in the thousands (with mean = 0, var = 1 as inputs). I get that it's basically impossible mathematically, but theoretically there is no such thing as a zero chance, is there a limit in reality though?

CodePudding user response:

No.

In practice, numbers are first generated uniformly randomly (which we're pretty good at), and then transformed to the target distribution. For 1D values, you can safely assume the np.random.normal uses inverse mapping from uniform [0, 1] to the quantile function of normal, so if the initially generated number is for example 0.000001, the resulting, returned value, would be cca -4.75. For the result to be -1000 (and not straight-up infinity, which of course is never returned), your initial uniform-random number would need to be cca 2.3 * 10^(-200000) (an ultra-small number, hardly represented in python or c ). The most you could get (from a theoretically infinitesimal float) is around -350, but note that the probability is probably not worth discussing.

  • Related