Skip to content

Instantly share code, notes, and snippets.

@ydnax
Created June 1, 2011 18:38
Show Gist options
  • Save ydnax/1002968 to your computer and use it in GitHub Desktop.
Save ydnax/1002968 to your computer and use it in GitHub Desktop.
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