Question: Walk in random direction

Hei, I'm trying to create a random walk in the plane, with constant step length (=1) and the angle between two consecutive steps are decided by a probability density function. I just can't seem to find out how I should implement the density function into my worksheet.

The probability density function is: p(phi)=(1/4)*cos(phi/2), on the interval [-Pi,Pi].
And  I think i managed to do it by selecting a random angle, but don't know how to generate a random angle given this probability function. Any ideas? It'd be highly appreciated!


Please Wait...