fix getEngine

This commit is contained in:
gin0606 2014-08-12 11:56:08 +09:00
parent 6722f8d546
commit 89cf0c1e8c
1 changed files with 3 additions and 3 deletions

View File

@ -37,18 +37,18 @@ public:
template<typename T>
static inline T random_real(T min, T max) {
std::uniform_real_distribution<T> dist(min, max);
std::mt19937 mt = RandomHelper::getEngine();
auto &mt = RandomHelper::getEngine();
return dist(mt);
}
template<typename T>
static inline T random_int(T min, T max) {
std::uniform_int_distribution<> dist(min, max);
std::mt19937 mt = RandomHelper::getEngine();
auto &mt = RandomHelper::getEngine();
return dist(mt);
}
private:
static std::mt19937 getEngine() {
static std::mt19937 &getEngine() {
static std::random_device seed_gen;
static std::mt19937 engine(seed_gen());
return engine;