import mir.random.engine; auto rv = bernoulliVar(0.7); static assert(isRandomVariable!(typeof(rv))); int[2] hist; foreach(_; 0..1000) hist[rv(rne)]++; //import std.stdio; //writeln(hist);
import mir.random.engine; Random* gen = threadLocalPtr!Random; auto rv = BernoulliVariable!double(0.7); int[2] hist; foreach(_; 0..10) hist[rv(gen)]++;
$(WIKI_D Bernoulli).