-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathRandomNumberGenerator.h
More file actions
30 lines (26 loc) · 865 Bytes
/
Copy pathRandomNumberGenerator.h
File metadata and controls
30 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef __RANDOMNUMBERGENERATOR__H__
#define __RANDOMNUMBERGENERATOR__H__
#include <boost/random.hpp>
#include <ctime>
typedef boost::mt19937 GeneratorType;
typedef boost::variate_generator< GeneratorType&, boost::exponential_distribution<> > ExponentialDistribution;
typedef boost::variate_generator< GeneratorType&, boost::normal_distribution<> > NormalDistribution;
typedef boost::variate_generator< GeneratorType&, boost::lognormal_distribution<> > LogNormalDistribution;
typedef boost::variate_generator< GeneratorType&, boost::gamma_distribution<> > GammaDistribution;
class RandomNumberGenerator
{
public :
RandomNumberGenerator()
{
m_rng=GeneratorType();
m_rng.seed(static_cast<unsigned int>(std::time(nullptr)));
};
~RandomNumberGenerator(){};
GeneratorType& getRNG()
{
return m_rng;
}
private:
GeneratorType m_rng;
};
#endif