OK, so what we have initially is a uniform random variable on the interval [0,1].

In Homework 6 question 4, it is proven that an exponential random variable with λ=0.5 is made out of two gaussian random variables with the relationship $ D=X^2+Y^2 $

So, what we need first is an exponential RV with λ=0.5.

Question 1.b on the same homework shows an exponential RV can be obtained from a uniform~[0,1] by

D = ln(1-U)/λ

In this case you just have to replace U with drand48() and λ by 0.5 .

Now that we have our exponential RV let's see how we can obtain X from D.

Thinking in polar form we can easily argue that X = D^(1/2)cos(ω)

So we need another uniform RV ω, which ranges from [0, 2π]

Thinking about how scaling a uniform RV also scales its range, dividing drand48() by 2π gives us ω. This is true since the height has been reduced to 1/2π, the base must expand to [0, 2π] so that the total area remains to be 1.

Now that we have defined D and ω in terms of drand48() it is just a matter of plugging the definitions in the equation.

Alumni Liaison

Meet a recent graduate heading to Sweden for a Postdoctorate.

Christine Berkesch