next up previous
Next: Exponential distribution Up: Random sequences Previous: Statistical errors

Non-uniform random distributions

In th eprevious section we learned how to generate random deviates with a uniform probability distribution in an interval $[a,b]$. This distributioon is normalized, so that

\begin{displaymath}
\int _a^b {P(x)dx}=1.
\end{displaymath}

Hence, $P(x)=1/(b-a)$.

Now, suppose that we generate a sequence $\{x_i\}$ and we take some function of it to generate $\{y(x_i)\}=\{y_i\}$. This new sequence is going to be distributed according to some probaility density $P(y)$, such that

\begin{displaymath}
P(y)dy=P(x)dx
\end{displaymath}

or

\begin{displaymath}
P(y)=P(x)\frac{dx}{dy}.
\end{displaymath}

If we want to generate a desired normalized distribution $P(y)$, we need to solve the differential equation:

\begin{displaymath}
\frac{dy}{dy}=P(y).
\end{displaymath}

But the solution of this is

\begin{displaymath}
x=\int _0^y {P(y')dy'}=F(y).
\end{displaymath}

Therefore,
\begin{displaymath}
y(x)=F^{-1}(x),
\end{displaymath} (95)

where $F^{-1}$ is the inverse of $F$.



Subsections

Adrian E. Feiguin 2004-06-01