Answers for "get rand int c++"

C++
0

c++ rand

#include <ctime>

int main() {
 srand((unsigned) time(0)); 
 int result = 1 + (rand() % 6); // return a number between 1 and 6
}
Posted by: Guest on March-25-2022

Browse Popular Code Answers by Language