
$$\begin{array}{ll}f\left(x\right)=\frac{1}{{b}^{a}\Gamma \left(a\right)}{x}^{a1}{e}^{x/b}& \text{if}x\ge 0\text{; \hspace{1em}}a,b>0\\ \\ f\left(x\right)=0& \text{otherwise.}\end{array}$$ 
(i)  if $a<1$, a switching algorithm described by Dagpunar (1988) (called G6) is used. The target distributions are ${f}_{1}\left(x\right)=ca{x}^{a1}/{t}^{a}$ and ${f}_{2}\left(x\right)=\left(1c\right){e}^{\left(xt\right)}$, where $c=t/\left(t+a{e}^{t}\right)$, and the switching argument, $t$, is taken as $1a$. This is similar to Ahrens and Dieter's GS algorithm (see Ahrens and Dieter (1974)) in which $t=1$; 
(ii)  if $a=1$, the gamma distribution reduces to the exponential distribution and the method based on the logarithmic transformation of a uniform random variate is used; 
(iii)  if $a>1$, the algorithm given by Best (1978) is used. This is based on using a Student's $t$distribution with two degrees of freedom as the target distribution in an envelope rejection method. 