Skip to main content

Function: binomProb()

binomProb(successes, trials, probability): number

Defined in: functions/binomProb.ts:16

Returns the probability of the binomial distribution.

Suppose a biased coin comes up heads with probability 0.3 when tossed. The probability of seeing exactly 4 heads in 6 tosses is binomProb(4, 6, 0.3).

Parameters

successes

number

The amount of successes. Must be an integer greater than or equal to 0 and less than or equal to trials.

trials

number

The number of trials. Must be an integer greater than or equal to 0.

probability

number

The probability of success. Must be a number from 0 to 1, inclusive. If you want to use a percentage, convert it to a decimal by dividing by 100 (e.g. 50% becomes 0.5).

Returns

number

The probability.

Example

binomProb(4, 6, 0.3); // 0.05953499999999999