lundi 28 janvier 2019

How can you make a random number generator that chooses between the number 2 or 3. (not 1,2,3)

Hi I am working on a monty hall generator and in part of my code I need it to generate random number 2 or 3. It cannot be 1,2,3 but the computer needs to select between 2 or 3. Thanks!

I have tried randomCarDoor = ( rand() % 3 ) + 1; but does not work.

randomCarDoor = ( rand() % 3 ) + 1;

It gives me the number 1,2,3 but I just want 2 and 3




Aucun commentaire:

Enregistrer un commentaire