i have this:
-
inline unsigned GetRandom(unsigned min, unsigned max) {
-
return rand() % (max - min + 1) + min;
-
}
-
i dont know what it means and does it return one value only?
this gives a pseudo random number between min and max, i.e. % has a higher precedence than + so the expression is
-
(rand() % (max - min + 1)) + min
-
the subexpression rand() % (max - min + 1) gives a number between 0 and max-min and then min is added to the result