Check that p is a valid probability (0 ≤ p ≤ 1)
mctad.bernoulli(.7).generate(100) will perform 100 Bernoulli trials, yielding 100
random variables each having had a success probability of .7.
Assign the probability mass and cumulative distribution functions for the outcomes 0 or 1.
Mix in the convenience methods for p(x) and F(x).
Bernoulli Distribution
The Bernoulli distribution is the probability discrete distribution of a random variable which takes value 1 with success probability
pand value 0 with failure probabilityq= 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 the Binomial Distribution wheren= 1.Assumptions
pis a valid probability (0 ≤ p ≤ 1).Use
mctad.bernoulli(p)Inline Comments