Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
MathUtils::RandomGenerator Class Reference

High-quality pseudo-random number generator based on xoshiro256**. More...

#include <MathUtils_Random.hxx>

Public Member Functions

 RandomGenerator (const uint64_t theSeed=1)
 Initialize with a seed value. Uses SplitMix64 to expand a single seed into the full 256-bit state, ensuring good initialization even from poor seeds.
 
void SetSeed (const uint64_t theSeed)
 Re-seed the generator.
 
uint64_t NextInt ()
 Generate next 64-bit unsigned integer.
 
double NextReal ()
 Generate next double in [0, 1). Uses 53 bits of randomness for full double precision.
 

Detailed Description

High-quality pseudo-random number generator based on xoshiro256**.

xoshiro256** is a general-purpose PRNG designed by David Blackman and Sebastiano Vigna. It has:

Suitable for Monte Carlo methods, stochastic optimization, and any application requiring high-quality randomness.

Constructor & Destructor Documentation

◆ RandomGenerator()

MathUtils::RandomGenerator::RandomGenerator ( const uint64_t theSeed = 1)
inlineexplicit

Initialize with a seed value. Uses SplitMix64 to expand a single seed into the full 256-bit state, ensuring good initialization even from poor seeds.

Parameters
theSeedseed value (default 1)

Member Function Documentation

◆ NextInt()

uint64_t MathUtils::RandomGenerator::NextInt ( )
inline

Generate next 64-bit unsigned integer.

Returns
pseudo-random value in [0, 2^64)

◆ NextReal()

double MathUtils::RandomGenerator::NextReal ( )
inline

Generate next double in [0, 1). Uses 53 bits of randomness for full double precision.

Returns
pseudo-random value in [0, 1)

◆ SetSeed()

void MathUtils::RandomGenerator::SetSeed ( const uint64_t theSeed)
inline

Re-seed the generator.

Parameters
theSeedseed value

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