\subsection{\bf Accept/Reject Method for Generating}
\subsection{\bf General Probability Distributions}

\begin{slide}
\begin{itemize}
\item (vi) Accept/Reject Method

\item This is an important practical method for generating random
numbers according to particular probability distributions, which
cannot be integrated so that $\int^x_{x_1} p(x)$ can be used as
described earlier.

\item We wish to generate $x$ according to a given probability
distribution $p(x)$ in range $x_1 \le x \le x_2$.

\item Put
\[
p_{\max} = \max_x p(x)
\]
Let $w_{\max}$ be (any number) $\ge p_{\max}$.

\item Generate $x$ uniformly in $\left\lbrack x_1 x_2\right\rbrack$. (*)

Generate $r$ uniformly in $[01]$.
\begin{eqnarray*}
\mbox{If}\ r & > & \frac{p(x)}{w_{\max}}\ \mbox{reject}\ x\ \mbox{and
start again at (*)} \\
&& \\
r & \le & \frac{p(x)}{w_{\max}}\ \mbox{accept}\ x
\end{eqnarray*}
\end{itemize}
\end{slide}

