Simpact Cyan
Population based event driven simulation using mNRM
Public Member Functions | List of all members
DiscreteDistribution Class Reference

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 the discrete distrubution specified in the constructor. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

DiscreteDistribution::DiscreteDistribution ( std::vector< double > &  binStarts,
std::vector< double > &  histValues,
GslRandomNumberGenerator pRndGen 
)

Constructor of the class.

Parameters
binStartsThe values of the start of each bin. These must be in ascending order.
histValuesMeasures of the integrated probability in each bin
pRndGenThe 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.

Member Function Documentation

double DiscreteDistribution::pickNumber ( ) const

Pick a number according to the discrete distrubution specified in the constructor.


The documentation for this class was generated from the following files: