pmd-red/src/other_random.c
2025-03-21 23:48:05 -04:00

24 lines
431 B
C

#include "global.h"
#include "other_random.h"
EWRAM_INIT u16 gOtherRngState = {0x348C}; // NDS=020EAC58
// arm9.bin::020127F4
static s32 OtherRandom16(void)
{
gOtherRngState = 109 * gOtherRngState + 1021;
return gOtherRngState;
}
// arm9.bin::020127DC
s32 OtherRandInt(s32 cap)
{
return (OtherRandom16() * cap) >> 16;
}
// arm9.bin::020127C4
s32 OtherRandRange(s32 a, s32 b)
{
return OtherRandInt(b - a) + a;
}