summaryrefslogtreecommitdiff
path: root/src/common/mt_rand.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-09-30 13:42:54 -0400
committerMadCamel <madcamel@gmail.com>2009-09-30 13:42:54 -0400
commitbf517943387f364ad7b11854d803a84612f8cf60 (patch)
tree5a2d64474535e6717cc8f186ff684618da00f1b1 /src/common/mt_rand.c
parentb396c9ae5d7fab3e13cff70e2a8ebc080aeeb472 (diff)
downloadtmwa-bf517943387f364ad7b11854d803a84612f8cf60.tar.gz
tmwa-bf517943387f364ad7b11854d803a84612f8cf60.tar.bz2
tmwa-bf517943387f364ad7b11854d803a84612f8cf60.tar.xz
tmwa-bf517943387f364ad7b11854d803a84612f8cf60.zip
Added -fno-strict-aliasing to CFLAGS
This will likely fix a few minor weirdnesses, and compiler warnings.
Diffstat (limited to 'src/common/mt_rand.c')
-rw-r--r--src/common/mt_rand.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/mt_rand.c b/src/common/mt_rand.c
index ab733ae..fc9a9ec 100644
--- a/src/common/mt_rand.c
+++ b/src/common/mt_rand.c
@@ -108,3 +108,12 @@ unsigned long mt_random(void)
y ^= (y << 15) & 0xEFC60000U;
return(y ^ (y >> 18));
}
+
+int mt_rand(void) {
+ unsigned long r = mt_random();
+ while (r >> 16)
+ r = (r & 0xFFFF) + (r >> 16);
+
+ return(r);
+}
+