#ifndef SIMUL_H_
#define SIMUL_H_
-#include<ctime>
#include<cassert>
#include "boost/random.hpp"
class simul {
public:
- simul() : rg(boost::mt19937(time(NULL))) {
- }
+ simul(unsigned int seed) : engine(seed), rg(engine, boost::random::uniform_01<>()) {
+ }
// interval : [,)
// random number should be in [0, arr[len - 1])
double random() { return rg(); };
private:
- boost::uniform_01<boost::mt19937> rg;
+ boost::random::mt19937 engine;
+ boost::random::variate_generator<boost::random::mt19937&, boost::random::uniform_01<> > rg;
};
#endif /* SIMUL_H_ */