create random.h

This commit is contained in:
sceptillion 2017-12-11 00:56:09 -08:00
parent fdf832bec1
commit 66219cd4af
3 changed files with 14 additions and 1 deletions

11
include/random.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef GUARD_RANDOM_H
#define GUARD_RANDOM_H
void SeedRng(u8 *seed);
s32 Random(void);
s32 RandomCapped(s32 cap);
s32 RandomRange(s32 a, s32 b);
s32 GetRngState(void);
void SetRngState(s32 state);
#endif // GUARD_RANDOM_H

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "random.h"
extern char ewram_start[];
@ -26,7 +27,6 @@ extern char unk_code[];
extern void sub_800CDA8(int);
extern void sub_800B540(void);
extern void sub_800CF0C(void);
extern void SeedRng(u8 *);
extern void sub_8004D78(void);
extern void nullsub_9(void);
extern void nullsub_6(void);

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "random.h"
extern s32 gRngState;
@ -26,6 +27,7 @@ s32 RandomCapped(s32 cap)
return (((Random() & 0xFFFF) * cap) >> 16) & 0xFFFF;
}
// Returns a random number between a and b.
s32 RandomRange(s32 a, s32 b)
{
if (a == b)