2017-12-05 19:27:33 +01:00
|
|
|
#ifndef GUARD_RANDOM_H
|
|
|
|
#define GUARD_RANDOM_H
|
2017-02-03 01:30:08 +01:00
|
|
|
|
|
|
|
extern u32 gRngValue;
|
|
|
|
extern u32 gRng2Value;
|
|
|
|
|
|
|
|
//Returns a 16-bit pseudorandom number
|
|
|
|
u16 Random(void);
|
|
|
|
u16 Random2(void);
|
|
|
|
|
|
|
|
//Returns a 32-bit pseudorandom number
|
|
|
|
#define Random32() (Random() | (Random() << 16))
|
2020-02-14 22:12:35 +01:00
|
|
|
|
|
|
|
// The number 1103515245 comes from the example implementation of rand and srand
|
|
|
|
// in the ISO C standard.
|
2020-02-14 22:05:43 +01:00
|
|
|
#define ISO_RANDOMIZE1(val)(1103515245 * (val) + 24691)
|
|
|
|
#define ISO_RANDOMIZE2(val)(1103515245 * (val) + 12345)
|
2017-02-03 01:30:08 +01:00
|
|
|
|
|
|
|
//Sets the initial seed value of the pseudorandom number generator
|
|
|
|
void SeedRng(u16 seed);
|
|
|
|
void SeedRng2(u16 seed);
|
|
|
|
|
2017-12-05 19:27:33 +01:00
|
|
|
#endif // GUARD_RANDOM_H
|