Function generating normal distribted values?

Hi!

I have been thinking before of function generating a normal distributed value from a random number evenly distributed between 0 and 1, but I have given up and declared it impossible by using simple formulas.

Then yesturday, in a programming forum, a guy presented a code line to generate a normal distributed value with a simple formula! But not by using a random number, but by using *two* random numbers!

The formula looks like this:

$\displaystyle \mu\ + \sigma\cdot\sqrt{-2\log(r_1)}\cdot\sin(r_2 2\pi)$

where $\displaystyle \mu$ is the mean, $\displaystyle \sigma$ is the standard derivation, and $\displaystyle r_1,\ r_2$ is two random numbers both evenly distributed between 0 and 1. Supposably the logarithm is ment to be the natural logarithm.

I hav already found the square root to have the probability distribution function $\displaystyle f(x)\ =\ x\cdot e^{-\frac{x}{2}}$, and the sinus function to have the distribution function $\displaystyle g(x)\ =\ \frac{1}{2\pi\sqrt{1-x^2}}$, but now is the problem, what is the distributing function $\displaystyle h$ of the *product* of the square root and the sin function?

I wrote down the following formula, but I don't know if it's true:

$\displaystyle h(a)\ =\ \int_{-\infty}^{+\infty}f(x)\cdot g\left(\frac{a}{x}\right)\cdot\frac{a}{x^2}\cdot dx\ =\ \int_{-\infty}^{+\infty}g(x)\cdot f\left(\frac{a}{x}\right)\cdot\frac{a}{x^2}\cdot dx\$

Someone who knows if it is true? Is this some kind of cartesian product between distribution functions? And if it is true, is there any way to simplify the integral?

Edit: It should probably be a factor two of that, so:

$\displaystyle h(a)\ =\ 2\ \int_{-\infty}^{+\infty}f(x)\cdot g\left(\frac{a}{x}\right)\cdot\frac{a}{x^2}\cdot dx\ =\ 2\ \int_{-\infty}^{+\infty}g(x)\cdot f\left(\frac{a}{x}\right)\cdot\frac{a}{x^2}\cdot dx\$