+ 5
Rand()
#include <iostream> #include <cstdlib> using namespace std; int main() { cout << rand(); } whenever I run it shows 41 why?????
3 Answers
+ 8
#include <ctime>
etc
int main() {
srand(time(0));
etc etc
+ 7
no seed
seed with srand()
+ 7
https://code.sololearn.com/cFxdiCUu5OG2/?ref=app
have a look at this code.
You might have to dig to find it. I am sure someone has a clearer example than this though