Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Crux::Random Class Reference

Static wrapper around RandomEngine for convenience. More...

#include <Random.h>

Static Public Member Functions

static void Seed (u64 seed=0ULL)
 Seeds the internal RandomEngine.
static f32 Float ()
 Returns a pseudorandom Float in [0.0f, 1.0f).
static f32 Float (f32 max)
 Returns a pseudorandom f32 in [0.0f, max).
static unsigned int Int (int max=100)
 Returns a pseudorandom integer in [0, max).
static unsigned int Int ()
 Returns a pseudorandom integer in [0, UINT_MAX].
static double Double (double max=1.0)
 Returns a pseudorandom double in [0.0, 1.0).
static double Double ()
 Returns a pseudorandom double in [0.0, 1.0).
static u64 U64 ()
 Returns a pseudorandom 64-bit unsigned integer.

Detailed Description

Static wrapper around RandomEngine for convenience.

Provides simple functions to seed the global engine and generate random values of various types and ranges.

Member Function Documentation

◆ Double() [1/2]

double Crux::Random::Double ( )
static

Returns a pseudorandom double in [0.0, 1.0).

Returns
Random double in [0.0, 1.0).

◆ Double() [2/2]

double Crux::Random::Double ( double max = 1.0)
static

Returns a pseudorandom double in [0.0, 1.0).

Parameters
maxExclusive upper bound. Defaults to 1.0.
Returns
Random double in [0.0, max).

◆ Float() [1/2]

f32 Crux::Random::Float ( )
static

Returns a pseudorandom Float in [0.0f, 1.0f).

Returns
Random f32 in [0.0, 1.0).

◆ Float() [2/2]

f32 Crux::Random::Float ( f32 max)
static

Returns a pseudorandom f32 in [0.0f, max).

Parameters
maxExclusive upper bound.
Returns
Random f32 in [0.0, max).

◆ Int() [1/2]

u32 Crux::Random::Int ( )
static

Returns a pseudorandom integer in [0, UINT_MAX].

Returns
Random unsigned integer.

◆ Int() [2/2]

u32 Crux::Random::Int ( int max = 100)
static

Returns a pseudorandom integer in [0, max).

Parameters
maxExclusive upper bound. Defaults to 100.
Returns
Random integer in [0, max).

◆ Seed()

void Crux::Random::Seed ( u64 seed = 0ULL)
static

Seeds the internal RandomEngine.

Parameters
seedThe 64-bit seed value. If zero, uses default state/stream.

◆ U64()

u64 Crux::Random::U64 ( )
static

Returns a pseudorandom 64-bit unsigned integer.

Combines two 32-bit Next() calls from the engine into one u64.

Returns
Random 64-bit unsigned integer.

The documentation for this class was generated from the following files: