The OpenD Programming Language

NegativeBinomialVariable

$(WIKI_D Negative_binomial).

Constructors

this
this(size_t r, T p)

Members

Functions

opCall
ulong opCall(RNG gen)
ulong opCall(RNG* gen)

Manifest constants

isRandomVariable
enum isRandomVariable;

Variables

max
enum ulong max;
min
enum ulong min;

Examples

import mir.random;
auto rv = negativeBinomialVar(30, 0.3);
static assert(isRandomVariable!(typeof(rv)));
size_t[ulong] hist;
foreach(_; 0..1000)
    hist[rv(rne)]++;
//import std.stdio;
//foreach(i; 0..100)
//    if(auto count = i in hist)
//        write(*count, ", ");
//    else
//        write("0, ");
//writeln();
import mir.random.engine;
Random* gen = threadLocalPtr!Random;
auto rv = NegativeBinomialVariable!double(30, 0.3);
size_t[ulong] hist;
foreach(_; 0..10)
    hist[rv(gen)]++;

Meta