Answers for "srand c++"

C++
0

srand() c++

#include <iostream>
#include <time.h> //you need to include this so you can use time

srand(unsigned int(time(NULL))); 
// this will try to "randomize" the value according to the current time
// some compilers will treat it as a warning if you dont define it as unsigned
Posted by: Guest on November-21-2021
1

random number c custom rand

rand() % (max_number + 1 - minimum_number) + minimum_number
Posted by: Guest on February-10-2020

Browse Popular Code Answers by Language