Using this basic boost example on boost's website if I have code like this:
#include <boost/random/mersenne_twister.hpp> #include <boost/random/variate_generator.hpp> #include <boost/random/uniform_real.hpp> boost::mt19937 gen; int roll_die() { boost::uniform_real<> dist(1, 6); boost::variate_generator<boost::mt19937&, boost::uniform_real<> > die(gen, dist); return die(); } If I wanted to do something like
boost::uniform_real<> dist(0.0, 6.0) It give me something like 1.4883 for example. Is there a way to get it to give me only values increment of 0.5.
Example: (0.0, 6.0)
If I ran the code 6 times it would give me something like this: 0.5, 1.5, 5.5, 6.0, 3.5, 3.0
How would I get it to do that?
Thanks.