Simpact Cyan
Population based event driven simulation using mNRM
betadistribution.h
Go to the documentation of this file.
1 #ifndef BETADISTRIBUTION_H
2 
3 #define BETADISTRIBUTION_H
4 
10 
17 {
18 public:
20  BetaDistribution(double a, double b, double minVal, double maxVal, GslRandomNumberGenerator *pRng) : ProbabilityDistribution(pRng) { m_a = a; m_b = b; m_minVal = minVal; m_scale = (maxVal-minVal); }
21 
22  double pickNumber() const;
23  double getA() const { return m_a; }
24  double getB() const { return m_b; }
25  double getMin() const { return m_minVal; }
26  double getScale() const { return m_scale; }
27 private:
28  double m_a, m_b, m_minVal, m_scale;
29 };
30 
31 inline double BetaDistribution::pickNumber() const
32 {
33  double x = getRandomNumberGenerator()->pickBetaNumber(m_a, m_b);
34  return x*m_scale + m_minVal;
35 }
36 
37 #endif // BETADISTRIBUTION_H
This class allows you to return a random number from a beta distribution with parameters specified in...
Definition: betadistribution.h:16
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
BetaDistribution(double a, double b, double minVal, double maxVal, GslRandomNumberGenerator *pRng)
The constructor specifies parameters for a (scaled) beta distribution.
Definition: betadistribution.h:20
double pickBetaNumber(double a, double b)
Pick a random number from a beta distribution with a and b as values for and respectively.
Definition: gslrandomnumbergenerator.cpp:134
double pickNumber() const
Pick a number according to a specific distrubution, specified in a subclass of ProbabilityDistributio...
Definition: betadistribution.h:31
Abstract base class for probability distribution implementations so that they can be used interchange...
Definition: probabilitydistribution.h:15