diff options
author | sceptillion <33798691+sceptillion@users.noreply.github.com> | 2017-12-11 09:18:22 -0800 |
---|---|---|
committer | sceptillion <33798691+sceptillion@users.noreply.github.com> | 2017-12-11 09:18:22 -0800 |
commit | 041c0891d8516a4c6a60652347ce77de996edb1d (patch) | |
tree | 4179bbd334339cd89d34a74fca90ab0ee9428f21 /src | |
parent | b0ef8f839bebb39c1806352cc8f87274927063b6 (diff) |
decompile other_random
Diffstat (limited to 'src')
-rw-r--r-- | src/other_random.c | 20 |
1 files changed, 20 insertions, 0 deletions
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; +} |