0
Always 41 out
2 Antworten
+ 2
try
#include <ctime>
#include <cstdlib>
#include <iostream>
int main() {
srand(time(0));
std::cout << (rand() % 5) + 1 << std::endl;
return 0;
}
different numbers between 1-5 everytime u execute it
+ 1
Try to first call the srand() function, with actual time as parameter:
http://www.cplusplus.com/reference/cstdlib/rand/