1 2 // Copyright 2009 Daniel James. 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) 5 6 // clang-format off 7 8 /*< This shouldn't be used. >*/ 9 10 //[ example1 11 12 /*` 13 Now we can define a function that simulates an ordinary 14 six-sided die. 15 */ roll_die()16int roll_die() { 17 boost::uniform_int<> dist(1, 6); /*< create a uniform_int distribution >*/ 18 } 19 20 //] 21 22 //[ example2 23 roll_die()24int roll_die() { 25 /*<< [important test] >>*/ 26 boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); 27 } 28 29 //] 30 31 //[ example3 32 roll_die()33int roll_die() { 34 /*<< [important test] 35 >>*/ 36 boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); 37 } 38 39 //] 40 41 //[ example4 42 roll_die()43int roll_die() { 44 /*<< callout 1 >>*/ 45 boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(gen, dist); 46 //[ example4a 47 /*<< callout 2 >>*/ 48 boost::uniform_int<> dist(1, 6); /*< create a uniform_int distribution >*/ 49 //] 50 } 51 52 //] 53