rndGeo

Purpose

Computes geometric pseudo-random numbers with a choice of underlying random number generator.

Format

y = rndGeo(r, c, prob)
{ y, newstate } = rndGeo(r, c, prob, state)
Parameters:
  • r (scalar) – row dimension.
  • c (scalar) – column dimension.
  • prob (scalar or matrix) – probability parameter, scalar or matrix ExE conformable with r and c columns
  • state (scalar or opaque vector) –

    Optional argument.

    scalar case

    state = starting seed value only. If -1, GAUSS computes the starting seed based on the system clock.

    opaque vector case

    state = the state vector returned from a previous call to one of the rnd random number functions.

Returns:
  • y (RxC matrix) – of geometrically distributed random numbers.
  • newstate (Opaque vector) – the updated state.

Remarks

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

\[ \begin{align}\begin{aligned}E(y) = \frac{1 - prob}{prob}\\Var(y) = \frac{1 - prob}{prob^2}\end{aligned}\end{align} \]

r and c will be truncated to integers if necessary.

See also

Functions rndCreateState(), rndStateSkip()