mardi 30 décembre 2014

Generate random numbers with rand() except number zero

I would like to generate random numbers between 1 and 25 with the method rand()

But I only know how to generate random numbers this way, which includes the number zero by default:



int r = rand() % 26 /* random int between 0 and 25 */


Anyone? Thank you.





Aucun commentaire:

Enregistrer un commentaire