I am making a trivia game and have questions in functions to get a random question I am trying to pick a random integer that is 0, 1, or 2. Depending on what I get I will then point to a function and run that function. I want to then make it so when I do this again I can make sure I don't get this integer again so as to not run the same question.
This is what I have now
srand(time(NULL));
int randomnumber;
randomnumber = rand() % 3;
but it is just getting a random integer between 0 and 2 and then not letting me select three direct integers and then take them out of this array if run.
Aucun commentaire:
Enregistrer un commentaire