Just getting into C++ I'm experimenting with random number generator
How is it that I would sometimes get the same number?
srand(time(0));
I have int as
int randNumb1 = 0;
int randNumb2 =0;
so it do this
randNumb1 = (rand() % 20) +1;
cout << "First Random number is " << randNumb1 << endl;;
randNumb2 = (rand() % 20) +1;
while (randNumb1 = randNumb2) {
randNumb2 = (rand() %20) +1;
cout << "Second number is " << randNumb2 << endl;;
// terminate the loop
break;
}