The OpenD Programming Language

MultinomialVariable

Multinomial distribution.

Constructors

this
this(size_t N, const(T)[] probs)

Members

Aliases

Element
alias Element = uint
opCall
void opCall(G* gen, uint[] result)

Functions

opCall
void opCall(G gen, uint[] result)

Manifest constants

isNdRandomVariable
enum isNdRandomVariable;

Variables

probs
const(T)[] probs;

Examples

Tests if sample returned is of correct size.

import mir.random.engine;
size_t s = 10000;
double[6] p =[1/6., 1/6., 1/6., 1/6., 1/6., 1/6.]; // probs must add up to one
auto rv = multinomialVar(s, p);
uint[6] x;
rv(rne, x[]);
assert(x[0]+x[1]+x[2]+x[3]+x[4]+x[5] == s);

Meta