Code:
/**
* RANDOM(high)
* Create random number between 0 and {high}
*
* @param high any number >= 0
*/
Code:
/**
* RANDOM_RANGE(low, high)
* Create random number between {low} and {high}
*
* @param low any number
* @param high any number >= {low}
*/
.
.
Which is better and why?
Code:
#define RANDOM_RANGE(low, high) (rand() % (high - low + 1) + low)
#define RANDOM(high) (rand() % (high + 1))
Or
Code:
#define RANDOM_RANGE(low, high) (rand() % (high - low + 1) + low)
#define RANDOM(high) RANDOM_RANGE(0, high)
How about if this kind of coding applied to functions?
Does it affect performance/code size?
Thanks in advance.