summaryrefslogtreecommitdiff
path: root/src/random.c
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 /src/random.c
parent6eb44dc50714f184cea4453704636370263e7efc (diff)
Use macro for randomization with ISO value
Diffstat (limited to 'src/random.c')
-rw-r--r--src/random.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/random.c b/src/random.c
index b570a7bc3..de923fba6 100644
--- a/src/random.c
+++ b/src/random.c
@@ -1,9 +1,6 @@
#include "global.h"
#include "random.h"
-// The number 1103515245 comes from the example implementation of rand and srand
-// in the ISO C standard.
-
EWRAM_DATA static u8 sUnknown = 0;
EWRAM_DATA static u32 sRandCount = 0;
@@ -13,7 +10,7 @@ u32 gRng2Value;
u16 Random(void)
{
- gRngValue = 1103515245 * gRngValue + 24691;
+ gRngValue = ISO_RANDOMIZE1(gRngValue);
sRandCount++;
return gRngValue >> 16;
}
@@ -31,6 +28,6 @@ void SeedRng2(u16 seed)
u16 Random2(void)
{
- gRng2Value = 1103515245 * gRng2Value + 24691;
+ gRng2Value = ISO_RANDOMIZE1(gRng2Value);
return gRng2Value >> 16;
}