#define get_rand(x, y) (((rand() % ((y) - (x))) + 1) + (x)) /* 0 index */ #define rand_percent(odds) ((get_rand(1, 100)) <= (odds))