The OpenD Programming Language

BernoulliVariable

$(WIKI_D Bernoulli).

Constructors

this
this(T p)

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

Meta