Function cmb_random_bernoulli

Function Documentation

static inline unsigned cmb_random_bernoulli(const double p)

A single Bernoulli trial. Returns 1 with probability p, otherwise 0. 0 <= p <= 1.

Used for any binary yes/no outcome of independent and identically distributed trials. A fair coin flip if p = 0.5.

See also https://en.wikipedia.org/wiki/Bernoulli_distribution