sead::GlobalRandom class

Base classes

class Random
A fast non-cryptographically secure pseudorandom number generator based on Xorshift128.

Public functions

void init()
Reset and seed the engine with the current system tick count.
void init(u32 seed)
Reset and seed the engine with the specified value.
void init(u32 seed_x, u32 seed_y, u32 seed_z, u32 seed_w)
auto getU32() -> u32
Generate a random u32.
auto getU32(u32 max) -> u32
Generate a random u32 in [0 .. max).
auto getU64() -> u64
Generate a random u64.
auto getS32Range(s32 a, s32 b) -> s32
auto getS64Range(s64 a, s64 b) -> s64
auto getF32() -> f32
Generate a random f32 in [0, 1).
auto getF32Range(f32 a, f32 b) -> f32
Generate a random f32 in [a, b).
auto getF64() -> f64
Generate a random f64 in [0, 1).
auto getF64Range(f64 a, f64 b) -> f64
Generate a random f64 in [a, b).
auto getBool() -> bool
Generate a random boolean.
void getContext(u32* x, u32* y, u32* z, u32* w) const

Function documentation

void sead::GlobalRandom::init()

Reset and seed the engine with the current system tick count.

void sead::GlobalRandom::init(u32 seed)

Reset and seed the engine with the specified value.

void sead::GlobalRandom::init(u32 seed_x, u32 seed_y, u32 seed_z, u32 seed_w)

u32 sead::GlobalRandom::getU32()

Generate a random u32.

u32 sead::GlobalRandom::getU32(u32 max)

Generate a random u32 in [0 .. max).

u64 sead::GlobalRandom::getU64()

Generate a random u64.

s32 sead::GlobalRandom::getS32Range(s32 a, s32 b)

Generate a random s32 in [a .. b). Note that this does not provide a uniform distribution.

s64 sead::GlobalRandom::getS64Range(s64 a, s64 b)

Generate a random s64 in [a .. b). Note that this does not provide a uniform distribution.

f32 sead::GlobalRandom::getF32()

Generate a random f32 in [0, 1).

f32 sead::GlobalRandom::getF32Range(f32 a, f32 b)

Generate a random f32 in [a, b).

f64 sead::GlobalRandom::getF64()

Generate a random f64 in [0, 1).

f64 sead::GlobalRandom::getF64Range(f64 a, f64 b)

Generate a random f64 in [a, b).

bool sead::GlobalRandom::getBool()

Generate a random boolean.

void sead::GlobalRandom::getContext(u32* x, u32* y, u32* z, u32* w) const