Random class
A fast non-cryptographically secure pseudorandom number generator based on Xorshift128.
Derived classes
- class GlobalRandom
Constructors, destructors, conversion operators
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 getU64() -> u64
- Generate a random u64.
- auto getU32(u32 max) -> u32
- Generate a random u32 in [0 .. max).
- 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
s32 sead:: Random:: getS32Range(s32 a,
s32 b)
Generate a random s32 in [a .. b). Note that this does not provide a uniform distribution.
s64 sead:: Random:: getS64Range(s64 a,
s64 b)
Generate a random s64 in [a .. b). Note that this does not provide a uniform distribution.