NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches

#include <game/cLib/c_random.hpp>

Description

Random number generation helper class.

Definition at line 6 of file c_random.hpp.

Public Member Functions

 cRandom_c (u32 seed)
 Initializes the class with the given seed.
u32 getRandomByAsm (ulong max)
 Generates an integer between 0 and the given max.
float getRandomFByAsm ()
 Generates a floating point number between 0 and 1.
float getRandomF2ByAsm ()
 Generates a floating point number between -0.5 and 0.5.

Public Attributes

u32 mSeed
 The current seed.

Private Member Functions

u32 ranqdStep ()
 Implementation of the ranqd1 algorithm.

Constructor & Destructor Documentation

◆ cRandom_c()

cRandom_c::cRandom_c ( u32 seed)
inline

Initializes the class with the given seed.

Definition at line 10 of file c_random.hpp.

Member Function Documentation

◆ getRandomByAsm()

u32 cRandom_c::getRandomByAsm ( ulong max)

Generates an integer between 0 and the given max.

Definition at line 32 of file c_random.cpp.

◆ getRandomFByAsm()

float cRandom_c::getRandomFByAsm ( )

Generates a floating point number between 0 and 1.

Definition at line 37 of file c_random.cpp.

◆ getRandomF2ByAsm()

float cRandom_c::getRandomF2ByAsm ( )

Generates a floating point number between -0.5 and 0.5.

Definition at line 43 of file c_random.cpp.

◆ ranqdStep()

u32 cRandom_c::ranqdStep ( )
inlineprivate

Implementation of the ranqd1 algorithm.

Bug
The implementation is flawed. This post explains why.

Definition at line 13 of file c_random.cpp.

Member Data Documentation

◆ mSeed

u32 cRandom_c::mSeed

The current seed.

Definition at line 16 of file c_random.hpp.