diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-08-31 13:22:39 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-08-31 13:22:39 -0600 |
commit | 67a8847e17aa72981bbf3b4c15167cc0ef499da1 (patch) | |
tree | 30b07708a5893712ea1a0bb4835881caa3dd97f7 /src/common/utils.h | |
parent | 0e36f6e8d82e7cb0f01683454790a7123ea03197 (diff) | |
parent | dbd9d0321c66deeecf01445f8298aa5076391fbd (diff) | |
download | tmwa-67a8847e17aa72981bbf3b4c15167cc0ef499da1.tar.gz tmwa-67a8847e17aa72981bbf3b4c15167cc0ef499da1.tar.bz2 tmwa-67a8847e17aa72981bbf3b4c15167cc0ef499da1.tar.xz tmwa-67a8847e17aa72981bbf3b4c15167cc0ef499da1.zip |
Merge commit 'taw/master'
Diffstat (limited to 'src/common/utils.h')
-rw-r--r-- | src/common/utils.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/utils.h b/src/common/utils.h index 794a0b6..0b006c3 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -1,3 +1,4 @@ +#include "mt_rand.h" #ifndef NULL #define NULL (void *)0 @@ -33,10 +34,9 @@ /* * ModuloRand and ModuloPlusRand. These macros are used to replace the - * vast number of calls to rand()%mod which is low-order bits. These - * instead use the high-order bits as suggested in the man page of rand(). + * vast number of calls to rand()%mod .. * MRAND(10), returns 0-9. * MPRAND(5,10) returns 5-14. */ -#define MRAND(mod) (int) ((float)mod * (rand() / (RAND_MAX + 1.0))) +#define MRAND(mod) (int) (mt_random() % mod) #define MPRAND(add, mod) add + MRAND(mod) |