std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(1,6);
int dice_roll = distribution(generator); // generates number in the range 1..6
为了重复使用,两者可以绑定在一起。
1 2
auto dice = std::bind ( distribution, generator );
int wisdom = dice()+dice()+dice();