This program generates Normally Distributed Pseudorandom Numbers with mean zero and variance one.
It does this by using the built-in Math.random function which generates Uniformly Distributed Pseudorandom Numbers in the interval [0, 1).
These are then transformed to Normally Distributed Pseudorandom Numbers by using the Inverse Normal Distribution Function.
See the section "Generating values from normal distribution" in the Wikipedia article Normal distribution.
The Inverse Normal Distribution Function is implemented by using a pre-computed table of values with linear interpolation. The generated values lie in the range [-4.864687, +4.864687].
The program displays the mean and variance for the number of samples chosen.
An alternative simpler program can be found here.
Last updated Saturday, June 16, 2018.