mercredi 18 juillet 2018

Rand function with two different result

my question is about rand function in c++ please check this, why this generate different results:

int a = 2 * rand()%5; // result = 0
int a = 2 * ( rand()%5 ); // result = 6

number 1

number 2




Aucun commentaire:

Enregistrer un commentaire