The OpenD Programming Language

Bernoulli2Variable

$(WIKI_D Bernoulli). A fast specialization for p := 1/2.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

opCall
bool opCall(RNG gen)
bool opCall(RNG* gen)

Manifest constants

isRandomVariable
enum isRandomVariable;

Variables

max
enum bool max;
min
enum bool min;

Examples

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)]++;

Meta