summaryrefslogtreecommitdiff
path: root/src/common/utils.h
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-08-29 20:43:53 -0400
committerMadCamel <madcamel@gmail.com>2009-08-29 20:45:59 -0400
commit837194519b2be29aa7665828e4d7cb8035fe1c3b (patch)
tree6aefce861fe537c58a585c5ec6e353331891e1ba /src/common/utils.h
parentde294e7c7d5ccf129eea3ce45c8023fa7b6d371d (diff)
downloadtmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.gz
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.bz2
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.xz
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.zip
Converted to Mersenne Twister for random.
Randomerer! Also: Fixed a security problem. Can you find it?
Diffstat (limited to 'src/common/utils.h')
-rw-r--r--src/common/utils.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/utils.h b/src/common/utils.h
index 794a0b6..ba96da1 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
@@ -38,5 +39,5 @@
* 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) ((float)mod * (mt_random() / (RAND_MAX + 1.0)))
#define MPRAND(add, mod) add + MRAND(mod)