Go to the first, previous, next, last section, table of contents.


CNRandomMix -- Mix of Several CNRandom Distributions

SYNOPSIS

#include <CNCL/RandomMix.h>

TYPE

CN_RANDOMMIX

BASE CLASSES

CNRandom

DERIVED CLASSES

None

RELATED CLASSES

CNRNG

DESCRIPTION

CNRandomMix generates random numbers from a mix of several CNRandom distributions.

Constructors:

CNRandomMix();
CNRandomMix(CNParam *param);
CNRandomMix(CNRandomMixEntry *tab, int length, CNRNG *gen);
Initializes a 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() ();
Draws a random number.


Go to the first, previous, next, last section, table of contents.