X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=simul.h;h=ba105dbde965dfadb1deeaeb7def93e3357cbb9b;hp=2719b3c9fb46fd67e6479775e3dfc6a1c113945f;hb=683863b75f8d8bef2461039a6911b0e9619cc113;hpb=a95154919f950f86de9104b2b9dcf1f0c7e83387 diff --git a/simul.h b/simul.h index 2719b3c..ba105db 100644 --- a/simul.h +++ b/simul.h @@ -1,13 +1,17 @@ #ifndef SIMUL_H_ #define SIMUL_H_ +#include #include +#include "boost/random.hpp" class simul { public: - virtual ~simul() {} + simul() : rg(boost::mt19937(time(NULL))) { + } + // 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 +33,10 @@ public: return l; } - virtual double random() { return 0.0; }; + double random() { return rg(); }; private: + boost::uniform_01 rg; }; #endif /* SIMUL_H_ */