generate random number in cpp in given range code example
Example 1: c++ how to generate a random number in a range
min + ( std::rand() % ( max - min + 1 ) )
Example 2: cpp random number in range
int range = max - min + 1;
int num = rand() % range + min;