pseudo random number generator example
Notice though that this modulo operation does not generate uniformly distributed random numbers in the span (since in most cases this operation makes lower numbers slightly more likely). C++ supports a wide range of powerful tools to generate random and pseudo-random numbers (see <random> for more info).