rndKMp

Purpose

Computes Poisson pseudo-random numbers.

Format

{ x, newstate } = rndKMp(r, c, lambda, state)
Parameters:
  • r (scalar) – number of rows of resulting matrix.
  • c (scalar) – number of columns of resulting matrix.
  • lambda (matrix or vector or scalar) – Shape argument for Poisson distribution, scalar or ExE conformable matrix with r and c.
  • state (scalar or 500x1 vector) –

    scalar case

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

    500x1 vector case

    state = the state vector returned from a previous call to one of the rndKM random number functions.
Returns:
  • x (RxC matrix) – Poisson distributed random numbers.
  • newstate (500x1 vector) – the updated state.

Remarks

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

\[\begin{split}E(x) = \lambda\\ Var(x) = \lambda\\ x = 0, 1,....\\ \lambda > 0\end{split}\]

r and c will be truncated to integers if necessary.

Technical Notes

rndKMp() uses the recur-with-carry KISS+Monster algorithm described in the rndKMi() Technical Notes.

Source

randkm.src