/* * random.hpp * * Created on: May 28, 2015 * Author: Jan Travnicek */ #ifndef __RANDOM_HPP_ #define __RANDOM_HPP_ #include <random> #include <limits> namespace std { class random_devices { public: static random_device random; private: class semirandom_device { public: typedef unsigned int result_type; private: std::mt19937 gen; std::uniform_int_distribution<unsigned int> dis; public: semirandom_device() : gen(random_devices::random()) { } result_type operator()() { return dis(gen); } result_type min() { return 0; } result_type max() { return numeric_limits<result_type>::max() ; } void seed ( unsigned int seed ) { gen.seed ( seed ); } }; public: static semirandom_device semirandom; }; } /* namespace std */ #endif /* __RANDOM_HPP_ */