summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-15 06:38:48 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-15 06:38:48 -0600
commitd6dbf554bd866124b7c676187c351c3f67fd3906 (patch)
tree2301dbf20ee0994963ccebfd1c5f7fd73e08a200 /src/common
parenta11a55e91bd25f52eac46a99f4c906e773245046 (diff)
parent29844ce5e2cd043551b46c1cd7bf3a36e357e3c6 (diff)
downloadtmwa-d6dbf554bd866124b7c676187c351c3f67fd3906.tar.gz
tmwa-d6dbf554bd866124b7c676187c351c3f67fd3906.tar.bz2
tmwa-d6dbf554bd866124b7c676187c351c3f67fd3906.tar.xz
tmwa-d6dbf554bd866124b7c676187c351c3f67fd3906.zip
Merge remote branch 'taw/master'
Diffstat (limited to 'src/common')
-rw-r--r--src/common/mt_rand.c9
-rw-r--r--src/common/mt_rand.h1
2 files changed, 10 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);
+}
+
diff --git a/src/common/mt_rand.h b/src/common/mt_rand.h
index 07f6ef0..bda5861 100644
--- a/src/common/mt_rand.h
+++ b/src/common/mt_rand.h
@@ -4,5 +4,6 @@
void mt_seed(unsigned long seed);
unsigned long mt_reload(void);
unsigned long mt_random(void);
+int mt_rand(void);
#endif /* __mt_rand_h */