Created
June 1, 2011 18:38
-
-
Save ydnax/1002968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct rndgen{ | |
boost::mt19937 rng; | |
rndgen(){ | |
rng.seed(static_cast<unsigned int>(std::time(0))); | |
} | |
template<class t> | |
t operator()(t min, t max){ | |
boost::uniform_real<t> u(min, max); | |
boost::variate_generator<boost::mt19937&, boost::uniform_real<t> > gen(rng, u); | |
return gen(); | |
} | |
}; | |
static rndgen gen_random; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment