# Thread: Gaussian Normal Dist. Formula

1. ## Gaussian Normal Dist. Formula

Hey guys, I'm writing a program to display a histogram of 1000 Gaussian distributed numbers. I've generated the numbers using rand and now need to transform them. I have found the following formula to use

f(x) = exp(-x^2 / (2*sigma^2)) / sqrt(2*pi*sigma)

and I am unsure how to implement this into a function.

Any help would be appreciated! Thanks.

2. The values returned by rand() typically approximate a uniform distribution. (Although the quality of implementation varies between libraries).

Google for techniques to convert a uniform distribution to a gaussian distribution. You will find plenty of information. It is not as simple as simply plugging in the formula you showed (which is the distribution function for a gaussian).

3. I've come across the Box-Muller method, and it seems like the best way to do it, but to be honest, i'm not really sure how to apply that. A general over view of the process would help greatly.