From 041c0891d8516a4c6a60652347ce77de996edb1d Mon Sep 17 00:00:00 2001 From: sceptillion <33798691+sceptillion@users.noreply.github.com> Date: Mon, 11 Dec 2017 09:18:22 -0800 Subject: decompile other_random --- src/other_random.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/other_random.c (limited to 'src') diff --git a/src/other_random.c b/src/other_random.c new file mode 100644 index 0000000..847530e --- /dev/null +++ b/src/other_random.c @@ -0,0 +1,20 @@ +#include "global.h" +#include "other_random.h" + +extern u16 gOtherRngState; + +static s32 OtherRandom16(void) +{ + gOtherRngState = 109 * gOtherRngState + 1021; + return gOtherRngState; +} + +s32 OtherRandomCapped(s32 cap) +{ + return (OtherRandom16() * cap) >> 16; +} + +s32 OtherRandomRange(s32 a, s32 b) +{ + return OtherRandomCapped(b - a) + a; +} -- cgit v1.2.3