Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the true maximum (and minimum) value of Random.nextGaussian()?

Tags:

In theory, the bounds for nextGaussian are meant to be positive and negative infinity. But since Random.nextDouble, which is used to calculate the Gaussian random number, doesn't come infinitely close to 0 and 1, there is a practical limit to nextGaussian. And Random.next is also not a perfectly uniform distribution.

It was theorised that the maximum should be about 2.2042*10^17 and related to the 53 bit shift of nextDouble (reference), but that is likely just an upper bound.

The answer probably depends on the distribution of Random.next and the exact implementation of StrictMath.sqrt and StrictMath.log. I couldn't find much information about either.

And yes, I know that the outer values are extremely unlikely, but it can be relevant, for example in the context of RNG manipulation in games.