I'm beginner in c++. I need to regenerate the same random number as it will be different under the below condition. How can I do it? Thank you!
int x = rand() % ((n_p)- 0 + 1) + 0;
if (A[x][0] == A[x][1])
{
// regenerate x as it will be different.
int x = rand() % ((n_p) - 0 + 1) + 0;
}
Aucun commentaire:
Enregistrer un commentaire