oa::Random

Random class in the OA Core public surface.

Public Types

Public Methods

Checkpoint oa::Random::checkpoint()
bool oa::Random::nextBool(oa::F64 inP = 0.5)
oa::F64 oa::Random::nextDouble()
oa::F32 oa::Random::nextFloat()
oa::F64 oa::Random::nextGaussian(oa::F64 inMean = 0.0, oa::F64 inStdDev = 1.0)
T oa::Random::nextRange(T inMin, T inMax)
oa::F64 oa::Random::nextRange(oa::F64 inMin, oa::F64 inMax)
oa::I64 oa::Random::nextRange(oa::I64 inMin, oa::I64 inMax)
oa::U32 oa::Random::nextU32()
oa::U64 oa::Random::nextU64()
oa::U64 oa::Random::rawInc()
oa::U64 oa::Random::rawState()
void oa::Random::restoreCheckpoint(const Checkpoint & inCheckpoint)
void oa::Random::seed(oa::U64 inSeed, oa::U64 inSeq = 1u)
void oa::Random::setRawState(oa::U64 inState, oa::U64 inInc)
void oa::Random::shuffle(T * inData, oa::U64 inCount)

Constructor & Destructor Documentation

oa::Random::Random( oa::U64 inSeed = 0x853C49E6748FEA9BULL, oa::U64 inSeq = 1u )
Fixed default seed → reproducible by default. Provide a seed for a specific stream; inSeq selects an independent stream for the same seed (two generators with the same seed but different inSeq never correlate).

Parameters

inSeed
oa::U64

Default: 0x853C49E6748FEA9BULL

inSeq
oa::U64

Default: 1u

Public Method Documentation

Checkpoint oa::Random::checkpoint()
No public source comment is attached to this declaration.

Returns

Checkpoint

The declared return value.

bool oa::Random::nextBool( oa::F64 inP = 0.5 )
Bernoulli — true with probability inP.

Parameters

inP
oa::F64

Default: 0.5

Returns

bool

The declared return value.

oa::F64 oa::Random::nextDouble()
No public source comment is attached to this declaration.

Returns

oa::F64

The declared return value.

oa::F32 oa::Random::nextFloat()
── Uniform reals in [0, 1) ─────────────────────────────────────────────

Returns

oa::F32

The declared return value.

oa::F64 oa::Random::nextGaussian( oa::F64 inMean = 0.0, oa::F64 inStdDev = 1.0 )
── Gaussian (Box–Muller, caches the paired variate) ────────────────────

Parameters

inMean
oa::F64

Default: 0.0

inStdDev
oa::F64

Default: 1.0

Returns

oa::F64

The declared return value.

T oa::Random::nextRange( T inMin, T inMax )
── Uniform integer in [inMin, inMax] inclusive (unbiased via rejection) ─

Parameters

inMin
T

inMax
T

Returns

T

The declared return value.

oa::F64 oa::Random::nextRange( oa::F64 inMin, oa::F64 inMax )
Uniform real in [inMin, inMax).

Parameters

inMin
oa::F64

inMax
oa::F64

Returns

oa::F64

The declared return value.

oa::I64 oa::Random::nextRange( oa::I64 inMin, oa::I64 inMax )
No public source comment is attached to this declaration.

Parameters

inMin
oa::I64

inMax
oa::I64

Returns

oa::I64

The declared return value.

oa::U32 oa::Random::nextU32()
── Core engine: PCG32 (32 random bits) ─────────────────────────────────

Returns

oa::U32

The declared return value.

oa::U64 oa::Random::nextU64()
No public source comment is attached to this declaration.

Returns

oa::U64

The declared return value.

oa::U64 oa::Random::rawInc()
No public source comment is attached to this declaration.

Returns

oa::U64

The declared return value.

oa::U64 oa::Random::rawState()
The complete state includes the Box-Muller cached variate. Raw state/inc access remains for compatibility with integer-only checkpoints; use checkpoint/restoreCheckpoint for exact continuation across all APIs.

Returns

oa::U64

The declared return value.

void oa::Random::restoreCheckpoint( const Checkpoint & inCheckpoint )
No public source comment is attached to this declaration.

Parameters

inCheckpoint
const Checkpoint &

Returns

void

The declared return value.

void oa::Random::seed( oa::U64 inSeed, oa::U64 inSeq = 1u )
No public source comment is attached to this declaration.

Parameters

inSeed
oa::U64

inSeq
oa::U64

Default: 1u

Returns

void

The declared return value.

void oa::Random::setRawState( oa::U64 inState, oa::U64 inInc )
No public source comment is attached to this declaration.

Parameters

inState
oa::U64

inInc
oa::U64

Returns

void

The declared return value.

void oa::Random::shuffle( T * inData, oa::U64 inCount )
── Fisher–Yates shuffle over a contiguous range ────────────────────────

Parameters

inData
T *

inCount
oa::U64

Returns

void

The declared return value.