# Generating random variables

• Jan 30th 2010, 09:48 PM
brogers
Generating random variables
If $f(x)=ax^{-a-1}$ where a is positive, how do I generate random variables from a uniform random number generator? Any help would be greatly appreciated.
• Jan 31st 2010, 12:41 AM
CaptainBlack
Quote:

Originally Posted by brogers
If $f(x)=ax^{-a-1}$ where a is positive, how do I generate random variables from a uniform random number generator? Any help would be greatly appreciated.

Let $F(x)$ be the cumulative distribution for a continuous random variable $X$, and let $Y \sim U(0,1)$. Then:

$Z=F^{-1}(Y)$

has cumulative distribution $F(z)$.

Hence if $y$ is a sample from the $U(0,1)$, $z=F^{-1}(y)$ is a sample from the distribution with cumulative distribution $F(z)$

CB