- #1
sandy.bridge
- 798
- 1
Can someone tell me why this random function is not random? I copied it exactly from my textbook, however, it only generates a "3", rather than a random number (1, 2, or 3).
PHP:
int randomMove ()//generates a random move for player 2
{
int x = rand () % 3 + 1;
return x;
}
int main() {
int play = randomMove ();
cout << play;
return 0;
}