This question already has an answer here:
- Generating random integer from a range 10 answers
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