Function cmb_random_flip
Defined in File cmb_random.h
Function Documentation
-
int cmb_random_flip(void)
A single flip of an unbiased coin. Returns 1 with
p = 0.5, 0 with the same probability.Equivalent to
cmb_random_bernoulli(0.5), but optimized for speed, only consuming one bit of randomness for each trial by caching random bits every 64 calls.See also https://en.wikipedia.org/wiki/Bernoulli_distribution (or https://sites.stat.columbia.edu/gelman/research/published/diceRev2.pdf)