rndgam#

Purpose#

Computes pseudo-random numbers with gamma distribution.

Note

rndgam() is deprecated and should be replaced with rndGamma().

Format#

x = rndgam(r, c, alpha)#
Parameters:
  • r (scalar) – number of rows of resulting matrix.

  • c (scalar) – number of columns of resulting matrix.

  • alpha (MxN matrix) – ExE conformable with r x c resulting matrix, shape parameters for gamma distribution.

Returns:

x (r x c matrix) – gamma distributed pseudo-random numbers.

Remarks#

The properties of the pseudo-random numbers in x are:

\[\begin{split}E(x) = \alpha\\ Var(x) = \alpha\\ x > 0\\ \alpha > 0\end{split}\]

Examples#

// Set seed for repeatable output
rndseed 12345;

// Generate a 3x2 matrix of gamma
// random numbers with shape = 5
x = rndgam(3, 2, 5);
print x;

After the code above, x is:

4.3270396        9.4093462
3.9689646        4.7393241
6.1082705        5.6436564

Source#

random.src

See also

Functions rndGamma()