Generating Random Numbers with a Normal Distribution

The common programming languages have functions for generating pseudo-random numbers, but they are white noise-all numbers have equal probability. To test statistical programs and to generate data for homework problems, a series of numbers that are normally distributed would be useful. There may be better ways, but one that works for me uses the equation for the normal distribution curve. My program asks for and plugs it into the equation as f(x) is calculated.

where

The probability of a range of numbers is the area of that range divided by the total area. This makes it easy to calculate the probability of a number. The ordinary pseudo-random number generator proposes a number, its probability is determined, and the dice are rolled again with the pseudo-random number generator to see if that probability is reached. If so, the number is added to the list. If not, another number is tested.