Raven Engine v0.1
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 (unsigned long long seed=0ULL)
 Seeds the internal RandomEngine.
static float Float ()
 Returns a pseudorandom float in [0.0f, 1.0f).
static float Float (float max)
 Returns a pseudorandom float 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 unsigned long long 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]

float Crux::Random::Float ( )
static

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

Returns
Random float in [0.0, 1.0).

◆ Float() [2/2]

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

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

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

◆ Int() [1/2]

unsigned int Crux::Random::Int ( )
static

Returns a pseudorandom integer in [0, UINT_MAX].

Returns
Random unsigned integer.

◆ Int() [2/2]

unsigned int 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 ( unsigned long long seed = 0ULL)
static

Seeds the internal RandomEngine.

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

◆ U64()

unsigned long long 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: