Answers for "cpp random number in range"

C++
2

c++ how to generate a random number in a range

min + ( std::rand() % ( max - min + 1 ) )
Posted by: Guest on August-22-2020
1

cpp random number in range

int range = max - min + 1;
int num = rand() % range + min;
Posted by: Guest on February-02-2021

Browse Popular Code Answers by Language