bernoulliDistribution
bernoulliDistribution(
p):number[]
Defined in: src/bernoulli_distribution.js:18
The Bernoulli distribution
is the probability discrete
distribution of a random variable which takes value 1 with success
probability p and value 0 with failure
probability q = 1 - p. It can be used, for example, to represent the
toss of a coin, where “1” is defined to mean “heads” and “0” is defined
to mean “tails” (or vice versa). It is
a special case of a Binomial Distribution
where n = 1.
Parameters
Section titled “Parameters”number
input value, between 0 and 1 inclusive
Returns
Section titled “Returns”number[]
values of bernoulli distribution at this point
Throws
Section titled “Throws”if p is outside 0 and 1
Example
Section titled “Example”bernoulliDistribution(0.3); // => [0.7, 0.3]