lundi 24 octobre 2016

Random number range not starting from 0 [duplicate]

This question already has an answer here:

I'm doing a random integer program with a range from 2 - 15 but I can't quite get it to start from 2, I can get it to start from 0 but not 2. Here is my code

random = rand() % 15 + 1;

I know this would be 0-15 but I'm not sure how to start it from 2.




Aucun commentaire:

Enregistrer un commentaire