import mir.random.engine; auto rv = bernoulli2Var; static assert(isRandomVariable!(typeof(rv))); int[2] hist; foreach(_; 0..1000) hist[rv(rne)]++;
import mir.random.engine; Random* gen = threadLocalPtr!Random; auto rv = Bernoulli2Variable.init; int[2] hist; foreach(_; 0..10) hist[rv(gen)]++;
$(WIKI_D Bernoulli). A fast specialization for p := 1/2.