diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/utils.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/utils.h b/src/common/utils.h index 29463cf..fa5cf57 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -31,3 +31,5 @@ if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\ { printf("SYSERR: realloc failure"); abort(); } } while(0) +#define MRAND(max) (int) ((float)max * (rand() / (RAND_MAX + 1.0))) +#define MMRAND(min, max) min + (int) ((float)max * (rand() / (RAND_MAX + (float)min))) |