NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
c_random.hpp
1#pragma once
2#include <types.h>
3
7class cM_rand_c {
8public:
9
11 cM_rand_c(u32 seed) : mSeed(seed) {}
12
13 u32 ranqd1(u32 max);
14 float ranqd2();
15 float ranqd3();
16
17 u32 mSeed;
18
19private:
23 inline u32 ranqdStep();
24
25 static u32 mConst1;
26 static u32 mConst2;
27};
Random number generation helper class.
Definition c_random.hpp:7
u32 ranqdStep()
Implementation of the ranqd1 algorithm.
Definition c_random.cpp:9
u32 mSeed
The current seed.
Definition c_random.hpp:17
cM_rand_c(u32 seed)
Initializes the class with the given seed.
Definition c_random.hpp:11
float ranqd3()
Generates a floating point number between -0.5 and 0.5.
Definition c_random.cpp:39
u32 ranqd1(u32 max)
Generates an integer between 0 and the given max.
Definition c_random.cpp:28
static u32 mConst1
Constant a from the ranqd1 algorithm.
Definition c_random.hpp:25
static u32 mConst2
Constant c from the ranqd1 algorithm.
Definition c_random.hpp:26
float ranqd2()
Generates a floating point number between 0 and 1.
Definition c_random.cpp:33