The C++ function random() generates random integers in the range 0 to 2147483647 (= 2^31-1) but they are uniformly distributed. That is, if you called random() many times a histogram of the values would appear flat, signifying each integer is equally likely to be generated. There is a neat and efficient trick for turning uniformly distributed numbers into normally distributed ones. Suppose x1 and x2 are random numbers chosen from a uniformly distributed random variable in the interval (0,1). Then
is normally distributed with mean 0 and standard deviation 1. Here are some fragments of C++ code to show you how to implement this idea: Normal Code Here is some test data to show that this works. Normal Data