# rndLCnb¶

## Purpose¶

Computes negative binomial pseudo-random numbers.

Note

This function is deprecated–use rndNegBinomial()–but remains for backward compatibility.

## Format¶

{ x, newstate } = rndLCnb(r, c, k, p, state)
Parameters:
• r (scalar) – number of rows of resulting matrix.

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

• k (matrix, vector or scalar) – r x c matrix or rx1 vector, or 1xc vector, or scalar, “event” argument for negative binomial distribution, scalar or ExE conformable matrix with r and c.

• p (matrix, vector or scalar) – “probability” argument for negative binomial distribution, scalar or ExE conformable matrix with r and c.

• state (scalar or vector) –

scalar case

state = starting seed value only. System default values are used for the additive and multiplicative constants.

The defaults are 1013904223, and 1664525, respectively. These may be changed with rndcon and rndmult.

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

3x1 vector case

  the starting seed, uses the system clock if -1  the multiplicative constant  the additive constant

4x1 vector case

state = the state vector returned from a previous call to one of the rndLC random number generators.

Returns:
• x (RxC matrix) – negative binomial distributed random numbers.

• newstate (4x1 vector) –

  the updated seed  the multiplicative constant  the additive constant  the original initialization seed

## Technical Notes¶

This function uses a linear congruential method, discussed in Kennedy, W.J. Jr., and J.E. Gentle, Statistical Computing, Marcel Dekker, Inc. 1980, pp. 136-147. Each seed is generated from the preceding seed using the formula

$new\_seed = (((a * seed) \% 2^{32})+ c) \% 2^{32}$

where % is the mod operator and where a is the multiplicative constant and c is the additive constant.

randlc.src