- 1
Why does rand() keep giving me same number?
I have been using this function to print a number that would be randomly generated in c++. However, I keep on getting 41 every time it complies. cout<<rand()%100;
2 odpowiedzi
+ 4
You need to seed random once before you use it.
srand(time(NULL));