Binomial Random Variate



Binomial Random Variate

A Binomial(n,p) random variable X can be represented as the sum of n independent Bernoulli random variables for which probability of assuming a 1 is p and the probability of assuming a 0 is 1 - p. X then takes on the values 0,...,n with the point probability distribution
f(i) =
Cni p i (1 - p) n-i for i = 0,...,n
0elsewhere
where Cni is the combination of n things taken i at a time.

Function List

  • int Binomial_Random_Variate( int n, double p )

    This function returns X where X is the Binomial(n,p) random variate described above.

Source Code

C source code is available for this routine: