summaryrefslogtreecommitdiff
path: root/include/random.h
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-02-14 16:12:35 -0500
committerhuderlem <huderlem@gmail.com>2020-02-25 12:54:08 -0600
commitfaf0ba8662ecd54b4160920097074aad3c2dc8cb (patch)
treec494ba3ef5757776bdcf7f66698d764c8f5ac43a /include/random.h
parent6eb44dc50714f184cea4453704636370263e7efc (diff)
Use macro for randomization with ISO value
Diffstat (limited to 'include/random.h')
-rw-r--r--include/random.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/random.h b/include/random.h
index 85ff71abf..6bf61de6c 100644
--- a/include/random.h
+++ b/include/random.h
@@ -10,6 +10,9 @@ u16 Random2(void);
//Returns a 32-bit pseudorandom number
#define Random32() (Random() | (Random() << 16))
+
+// The number 1103515245 comes from the example implementation of rand and srand
+// in the ISO C standard.
#define ISO_RANDOMIZE1(val)(1103515245 * (val) + 24691)
#define ISO_RANDOMIZE2(val)(1103515245 * (val) + 12345)