2017-02-03 01:30:08 +01:00
|
|
|
#include "global.h"
|
2017-12-05 19:27:33 +01:00
|
|
|
#include "random.h"
|
2017-02-03 01:30:08 +01:00
|
|
|
|
2017-02-03 18:32:51 +01:00
|
|
|
EWRAM_DATA static u8 sUnknown = 0;
|
|
|
|
EWRAM_DATA static u32 sRandCount = 0;
|
2017-02-03 01:30:08 +01:00
|
|
|
|
2018-04-29 14:21:59 +02:00
|
|
|
// IWRAM common
|
2019-06-26 22:23:00 +02:00
|
|
|
u32 gRngValue;
|
|
|
|
u32 gRng2Value;
|
2018-04-29 14:21:59 +02:00
|
|
|
|
2017-09-08 18:28:00 +02:00
|
|
|
u16 Random(void)
|
2017-02-03 01:30:08 +01:00
|
|
|
{
|
2020-02-14 22:12:35 +01:00
|
|
|
gRngValue = ISO_RANDOMIZE1(gRngValue);
|
2017-02-03 01:30:08 +01:00
|
|
|
sRandCount++;
|
|
|
|
return gRngValue >> 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SeedRng(u16 seed)
|
|
|
|
{
|
|
|
|
gRngValue = seed;
|
|
|
|
sUnknown = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SeedRng2(u16 seed)
|
|
|
|
{
|
|
|
|
gRng2Value = seed;
|
|
|
|
}
|
|
|
|
|
|
|
|
u16 Random2(void)
|
|
|
|
{
|
2020-02-14 22:12:35 +01:00
|
|
|
gRng2Value = ISO_RANDOMIZE1(gRng2Value);
|
2017-02-03 01:30:08 +01:00
|
|
|
return gRng2Value >> 16;
|
|
|
|
}
|