I want to randomize variables a and b to output a random number 1 through 4 in the format of a,b. However, when I run my following code, the output is always the same no matter how many times I run it. For example, the output is always: 4,3 (same output shown 10 times.)
What did I do wrong here? Can someone point me in the right direction? Thanks!
#include <iostream>
using namespace std;
int main()
{
int x;
int a, b;
a= rand() % 4 + 1;
b= rand() % 4 + 1;
x = 0;
while (x < 10) {
x++;
cout << a << "," << b << endl;
}
return 0;
}