\section{RANDGAMMA Generate Gamma-Distributed Random Variable}

\subsection{Usage}

Generates random variables with a gamma distribution.  The general
syntax for its use is
\begin{verbatim}
   y = randgamma(a,r),
\end{verbatim}
where \verb|a| and \verb|r| are vectors describing the parameters of the
gamma distribution.  Roughly speaking, if \verb|a| is the mean time between
changes of a Poisson random process, and we wait for the \verb|r| change,
the resulting wait time is Gamma distributed with parameters \verb|a| 
and \verb|r|.
\subsection{Function Internals}

The Gamma distribution arises in Poisson random processes.  It represents
the waiting time to the occurance of the \verb|r|-th event in a process with
mean time \verb|a| between events.  The probability distribution of a Gamma
random variable is
\[
   P(x) = \frac{a^r x^{r-1} e^{-ax}}{\Gamma(r)}.
\]
Note also that for integer values of \verb|r| that a Gamma random variable
is effectively the sum of \verb|r| exponential random variables with parameter
\verb|a|.
\subsection{Example}

Here we use the \verb|randgamma| function to generate Gamma-distributed
random variables, and then generate them again using the \verb|randexp|
function.
\begin{verbatim}
--> randgamma(1,15*ones(1,9))
ans = 
  <float>  - size: [1 9]
 
Columns 1 to 7
 22.780443  11.551359  16.853683  12.745702  16.230314  10.744172  19.394232  
 
Columns 8 to 9
 16.361151  17.477238  
--> sum(randexp(ones(15,9)))
ans = 
  <float>  - size: [1 9]
 
Columns 1 to 6
 14.6404095  15.1859598  13.3146982  11.4380150   7.2307277  10.8224525  
 
Columns 7 to 9
 14.5270958  12.4630632  11.8753099  

\end{verbatim}
