Function for generating values from binomial distributions.

Interface

binomial(n:int, p:real) : int

where n>=1 and 0.0<=p<=1.0. This function returns a drawing from a binomial distribution with n experiments and probability p for
success.

It raises Binomial exception if n<1 or p<0.0 or p>1.0.

Characteristics

  • Mean: np
  • Variance: np(1-p)

Probability mass functions for binomial distributions:

Probability mass functions for binomial distributions

Probability mass functions for binomial distributions

Example

binomial (100, 1.0/6.0)

Throw a die 100 times and observe how many times a six was thrown. This process has a binomial distribution with parameters n=100 and p=1/6.

Related pages

Random distribution functions

Beta
Chi-square

You must be logged in to post a comment.