mirror of
https://github.com/pret/pmd-red.git
synced 2026-06-16 13:40:31 -05:00
21 lines
349 B
C
21 lines
349 B
C
#include "global.h"
|
|
#include "other_random.h"
|
|
|
|
EWRAM_INIT u16 gOtherRngState = {0x348C};
|
|
|
|
static s32 OtherRandom16(void)
|
|
{
|
|
gOtherRngState = 109 * gOtherRngState + 1021;
|
|
return gOtherRngState;
|
|
}
|
|
|
|
s32 OtherRandInt(s32 cap)
|
|
{
|
|
return (OtherRandom16() * cap) >> 16;
|
|
}
|
|
|
|
s32 OtherRandRange(s32 a, s32 b)
|
|
{
|
|
return OtherRandInt(b - a) + a;
|
|
}
|