Simpact Cyan
Population based event driven simulation using mNRM
|
Helper class to generate random numbers based on some kind of discrete distribution. More...
#include <discretedistribution.h>
Public Member Functions | |
DiscreteDistribution (std::vector< double > &binStarts, std::vector< double > &histValues, GslRandomNumberGenerator *pRndGen) | |
Constructor of the class. More... | |
double | pickNumber () const |
Pick a number according to a specific distrubution, specified in a subclass of ProbabilityDistribution . More... | |
Helper class to generate random numbers based on some kind of discrete distribution.
You'll need to specify the sizes of the bins and the values of the bins, which are a measure of the integrated probability density inside bin.
DiscreteDistribution::DiscreteDistribution | ( | std::vector< double > & | binStarts, |
std::vector< double > & | histValues, | ||
GslRandomNumberGenerator * | pRndGen | ||
) |
Constructor of the class.
binStarts | The values of the start of each bin. These must be in ascending order. |
histValues | Measures of the integrated probability in each bin |
pRndGen | The random number generator to use for randomness when picking numbers according to this distribution. |
The value at the start of the last bin should be zero.
|
virtual |
Pick a number according to a specific distrubution, specified in a subclass of ProbabilityDistribution .
Implements ProbabilityDistribution.