use rand for particular interval in c code example
Example 1: c rand range
rand() % (max_number + 1 - minimum_number) + minimum_number
Example 2: c++ how to generate a random number in a range
min + ( std::rand() % ( max - min + 1 ) )
rand() % (max_number + 1 - minimum_number) + minimum_number
min + ( std::rand() % ( max - min + 1 ) )