#ifndef UNIFORM_H #define UNIFORM_H #include #include #include "../random/RandomGenerator.h" #include namespace Distribution { /** uniform distribution */ template class Uniform { private: Random::RandomGenerator gen; /** depending on T, Dist is either a uniform_real or uniform_int distribution */ typedef typename std::conditional< std::is_floating_point::value, std::uniform_real_distribution, std::uniform_int_distribution >::type Dist; Dist dist; public: /** ctor */ Uniform(const T min, const T max) : gen(RANDOM_SEED), dist(min, max) { } /** get a uniformaly distributed random number */ T draw() { return dist(gen); } /** set the seed to use */ void setSeed(const long seed) { gen.seed(seed); } }; } #endif // UNIFORM_H