, rand() , X-, X RAND_MAX% 7. , - rand(). , , .
++ 11 <random>, RNG. :
#include <random>
#include <functional>
auto rand = std::bind(std::uniform_int_distribution<int>(1,7),std::mt19937());
, rand(), 1 7 . ( , .) if-else, std::rand(). <random> . discrete_distribution. 0 n.
auto _rand = std::bind(std::discrete_distribution<int>{1./7.,1./7.,2./7.,2./7.,1./7.},std::mt19937());
auto rand = [&_rand]() { return _rand() +1; };