It's a good answer!
Using modulo may introduce bias into the random numbers, depending on the random number generator. See this question for more info. Of course, it's perfectly possible to get repeating numbers in a random sequence.
Try some C++11 features for better distribution:
#include <random>
#include <iostream>
int main()
{
std::random_device dev;
…
Top comments (0)