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>

Inheritance diagram for DiscreteDistribution:
Inheritance graph
[legend]
Collaboration diagram for DiscreteDistribution:
Collaboration graph
[legend]

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...
 

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
virtual

Pick a number according to a specific distrubution, specified in a subclass of ProbabilityDistribution .

Implements ProbabilityDistribution.


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