I'm struggling to find a way to generate a random number only between 20 and 30. I have this so far but its getting numbers below 20.
int num1 = 30;
int num2 = 20;
int num_random = rand()%num1;
while (num_random < num2){
num_random = rand()%30;
}
Aucun commentaire:
Enregistrer un commentaire