CNRandom
Distributions
#include <CNCL/RandomMix.h>
CN_RANDOMMIX
CNRandom
None
CNRNG
CNRandomMix
generates random numbers from a mix of several
CNRandom
distributions.
Constructors:
CNRandomMix();
CNRandomMix(CNParam *param);
CNRandomMix(CNRandomMixEntry *tab, int length, CNRNG *gen);
CNRandomMix
distribution with a base random number
generator gen
and a table of several distributions.
The following example shows how to use a CNRandomMixEntry
table
with 3 different distributions and their corresponding probabilities
for a CNRandomMix
distribution:
CNLogNormal ex1(10, 0.5, &generator1); CNNormal ex2(12, 0.3, &generator2); CNHyperExp ex3(10, 0.5, &generator3); CNRandomMixEntry tab[] = { { 0.1, &ex1 }, { 0.5, &ex2 }, { 0.4 &ex3 } }; CNRandomMix ex(tab, 3, &generator);
In addition to the member functions required by CNCL, CNRandomMix
provides:
virtual double operator() ();
Go to the first, previous, next, last section, table of contents.