This is actually a special case of a general method: let X be a continuous r.v. with cdf F. Let F-1 be the generalized inverse of F, that is F-1(y) = inf{x:F(x)≥y}
Note that if F is strictly increasing the generalized inverse is just the regular inverse, and that F(F-1(x)) = x
Now say we want to generate a r.v. X with cdf F. Let U~U[0,1], then X=F-1(U) ~ F because
Unfortunately the exponential is just about the only application of this method because it is one of the few r.v's with an explicit formula for the cdf.
The exponential has a relationship with some of the other r.v.s we have discussed and this can be used to generate some of them. For example
The problem with this algorithm is that it requires the computation of the sin and the cos functions. Here is a similar and much faster algorithm:
1) generate U1 and U2 are iid U[0,1]
2) set V1 = 2U1 -1, V2 = 2U2 -1 and S =V12 + V22
3) If S>1, return to step 1
otherwise set
then X and Y are iid standard normal. (This is called the polar method)