summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-11-03 20:52:28 +0000
committerDennis Friis <peavey@placid.dk>2008-11-03 20:52:28 +0000
commitcbe24b20cb2c2286485aa69de077fc63b7d8a51d (patch)
treebeaf0f4aed4f4331f8fcfbe2268313df428ce47e /src/common
parenta7f3726a0a7f16bccb664871fe35e8d2f2572f00 (diff)
downloadtmwa-cbe24b20cb2c2286485aa69de077fc63b7d8a51d.tar.gz
tmwa-cbe24b20cb2c2286485aa69de077fc63b7d8a51d.tar.bz2
tmwa-cbe24b20cb2c2286485aa69de077fc63b7d8a51d.tar.xz
tmwa-cbe24b20cb2c2286485aa69de077fc63b7d8a51d.zip
Add 2 defines for rand() that uses hi-order bits to get slighty better pseudo-random numbers
Diffstat (limited to 'src/common')
-rw-r--r--src/common/utils.h2
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)))