This question already has an answer here:
Created NUMBER_RANGE in #define NUMBER_RANGE 100 and able to generate random number from 0 to 100 but not able to generate uniformly distributed random numbers
I have tried in multiple ways by replacing % with / and considering other examples but not able to solve it.
itoa(rand() % (NUMBER_RANGE + 1), sendMessageStr,10);
Aucun commentaire:
Enregistrer un commentaire