Normally Distributed Pseudorandom Numbers

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 adding up 12 of the numbers then subtracting the number 6.

See the section "Generating values from normal distribution" in the Wikipedia article Normal distribution.

The generated values lie in the range [-6, +6].

The program displays the mean and variance for the number of samples chosen.

The JavaScript code used (main.js) can be downloaded here.

Enter Number of Samples


Results




An alternative (and slightly faster) method can be found here.


Last updated Saturday, April 22, 2017.


Valid HTML 4.01 Transitional