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 (const std::vector< double > &binStarts, const std::vector< double > &histValues, bool floor, 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 | ( | const std::vector< double > & | binStarts, |
const std::vector< double > & | histValues, | ||
bool | floor, | ||
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 |
floor | If set to true, only the bin start values will be returned, otherwise a constant probability is assumed within a 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.