rndnb#
Purpose#
Computes pseudo-random numbers with negative binomial distribution.
Format#
- x = rndnb(r, c, k, p)#
- Parameters:
r (scalar) – number of rows of resulting matrix.
c (scalar) – number of columns of resulting matrix.
k (MxN matrix) – ExE conformable with r x c resulting matrix, “event” parameters for negative binomial distribution.
p (KxL matrix) – ExE conformable with r x c resulting matrix, “probability” parameters for negative binomial distribution.
- Returns:
x (RxC matrix) – negative binomial distributed pseudo-random numbers.
Remarks#
The properties of the pseudo-random numbers in x are:
Examples#
// Set seed for repeatable output
rndseed 12345;
// Generate a 3x2 matrix of negative binomial
// random numbers with k = 5 and p = 0.3
x = rndnb(3, 2, 5, 0.3);
print x;
After the code above, x is:
0.0000000 0.0000000
2.0000000 2.0000000
5.0000000 0.0000000
Source#
random.src