mirror of
https://github.com/pret/pmd-red.git
synced 2026-07-31 07:47:29 -05:00
24 lines
431 B
C
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;
|
|
}
|