Derivation of Rayleigh-distributed random variable

I only have a uniform distribution function between [0,1]. And from this distribution, I should generate a sequence of Rayleigh distributed random variable using some software.

Anyhow, I was able to finish the problem using the formula from the Wikipedia article:

$$(1)\;\;\;\;X=\sigma\sqrt{-2\ln(U)}$$

However, there is only one thing I could not understand. I tried many times to derive formula $(1)$ using the Inverse transform sampling method, but I could not.

Can someone show me the steps of how $(1)$ is found?

If random variable $X$ has CDF $F(x)$, then $F^{-1}(U)$ is a sample of $X$ where $U$ is uniformly distributed on the unit interval. This is a standard result in probability theory, and I assume that you do not need a proof of this.
The CDF of a Rayleigh random variable $X$ is $$F(x) = 1 - \exp\left(-\frac{x^2}{2\sigma^2}\right), ~~x \geq 0,$$ and so $F^{-1}(y) = \sigma\sqrt{-2\ln(1-y)}$. But, since $1-U$ is also uniformly distributed on the unit interval, we save one subtraction by using $X = \sigma\sqrt{-2\ln( U})$ instead.
• @cardinal Nice point! And if the RNG has both $0$ and $1$ as possible valid outputs, then some re-programming might be necessary... – Dilip Sarwate Jan 10 '13 at 2:30