X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=simul.h;h=07c1c65ec8d243b147bc70150b3e50fc381824c4;hb=810375ef69e0de93188c6fa3819cfc584a32ff34;hp=2719b3c9fb46fd67e6479775e3dfc6a1c113945f;hpb=a95154919f950f86de9104b2b9dcf1f0c7e83387;p=rsem.git diff --git a/simul.h b/simul.h index 2719b3c..07c1c65 100644 --- a/simul.h +++ b/simul.h @@ -3,11 +3,14 @@ #include +#include "boost/random.hpp" class simul { public: - virtual ~simul() {} + simul(unsigned int seed) : rg(boost::mt19937(seed)) { + } + // interval : [,) // random number should be in [0, arr[len - 1]) // If by chance arr[len - 1] == 0.0, one possibility is to sample uniformly from 0 ... len - 1 @@ -29,9 +32,10 @@ public: return l; } - virtual double random() { return 0.0; }; + double random() { return rg(); }; private: + boost::uniform_01 rg; }; #endif /* SIMUL_H_ */