Function cmb_random_negative_binomial

Function Documentation

unsigned cmb_random_negative_binomial(unsigned m, double p)

Negative binomial distribution, the number of failures before the mth success in independent Bernoulli trials each with probability p, sampled with replacement (or equivalently from an infinite pool).

Mean m(1-p)/p, variance m(1-p)/p^2. Equal to a geometric distribution for m = 1.

Used to model e.g., the number of bits (or packets) that need to be sent to successfully transmit an m-bit (or -packet) message. Also known as the Pascal distribution.

Performs the calculation by simulating the experiment.

See also https://en.wikipedia.org/wiki/Negative_binomial_distribution