Generate a binomially-distributed random number; the number of successes in n trials each with probability p.
n
p
The approach follows the BRTS algorithm of Hormann 1992 for large min(n * p, n * (1 - p)) > 10 and uses an inversion algorithm for small n * p.
min(n * p, n * (1 - p)) > 10
n * p
Random number state
Number of trials
Per-trial probability of success
Generated using TypeDoc
Generate a binomially-distributed random number; the number of successes in
n
trials each with probabilityp
.The approach follows the BRTS algorithm of Hormann 1992 for large
min(n * p, n * (1 - p)) > 10
and uses an inversion algorithm for smalln * p
.