blob: 847530e0a07c846016a6da74a08f1984fa2ab8e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}
|