Table of contents
Example 1:
Now we can define a function that simulates an ordinary six-sided die.
int roll_die() { boost::uniform_int<> dist(1, 6); (1) }
create a uniform_int distribution
Example 2:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 3:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 3 (again!):
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 4:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); (2)boost::uniform_int<> dist(1, 6); (3) }
(1)boost::uniform_int<> dist(1, 6); (2)
Example 1:
Now we can define a function that simulates an ordinary six-sided die.
int roll_die() { boost::uniform_int<> dist(1, 6); (1) }
create a uniform_int distribution
Example 2:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 3:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 3 (again!):
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); }
test
Example 4:
int roll_die() { (1)boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); (2)boost::uniform_int<> dist(1, 6); (3) }
(1)boost::uniform_int<> dist(1, 6); (2)