Skip to main content

Bernoulli

Returns true or false with the probability of true given by the parameter p (with default value 0.5).

The probability mass function is given by,

P(xp)={pif b=11pif b=0.P(x | p) = \begin{cases} p & \text{if } b = 1 \\ 1-p & \text{if } b = 0 \end{cases}.

Constructors

Bernoulli(const Bernoulli distribution) -> Bernoulli

Copy constructor for Bernoulli distribution.

Parameters

  • distribution: Bernoulli distribution to be copied

Symbols

NameDescription
=Copy assignment operator for Bernoulli distribution.

Members

NameDescription
maxReturns the maximum possible value from the distribution
minReturns the minimum possible value from the distribution
pProbability of success.
sampleSample from distribution.