When using the results generated by a random number generator, the modulo operation (%) can limit the result to a range with an upper bound of one less than the maximum value of the operand.
For example: