From 09f27128f82c716762a3de9f86d6799ac7946abb Mon Sep 17 00:00:00 2001 From: SatoMew Date: Sat, 6 Oct 2018 17:27:58 +0100 Subject: decompile random.c --- src/random.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/random.c (limited to 'src') diff --git a/src/random.c b/src/random.c new file mode 100644 index 000000000..54dae0824 --- /dev/null +++ b/src/random.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "random.h" + +// The number 1103515245 comes from the example implementation +// of rand and srand in the ISO C standard. + +u32 gRngValue; + +u16 Random(void) +{ + gRngValue = 1103515245 * gRngValue + 24691; + return gRngValue >> 16; +} + +void SeedRng(u16 seed) +{ + gRngValue = seed; +} -- cgit v1.2.3