Documentation 6b54b78464
Loading...
Searching...
No Matches
RandomToolbox

Functions

uint64_t RandomToolbox::GetHash (unsigned long nodeIndex, unsigned short iDim, unsigned long timeIter)
 Generate a deterministic 64-bit hash from three integers.
 
double RandomToolbox::HashToUniform (uint64_t x)
 Convert a 64-bit hash into a uniform double in (0,1]. Uses the top 53 bits of the hash to fill the mantissa of a double. Ensures the result is never zero, suitable for Box-Muller transform.
 
double RandomToolbox::HashToNormal (uint64_t x)
 Generate a standard normal random number from a 64-bit hash. Uses two deterministic uniforms derived from the hash and its bitwise NOT as inputs to the Box-Muller transform.
 
double RandomToolbox::GetNormal (unsigned long nodeIndex, unsigned long dim, unsigned long timeIter)
 Generate a deterministic standard normal number for a cell, dimension, and timestep.
 
template<class T >
T RandomToolbox::GetBesselZero (const T &x)
 Compute modified bessel function of first kind (order 0).
 
template<class T >
T RandomToolbox::GetBesselIntegral (const T &beta_x, const T &beta_y, const T &beta_z)
 Compute integral involving the product of three modified Bessel functions. Useful for scaling the smoothed stochastic source terms in Langevin equations.
 

Detailed Description

Function Documentation

◆ GetBesselIntegral()

template<class T >
T RandomToolbox::GetBesselIntegral ( const T &  beta_x,
const T &  beta_y,
const T &  beta_z 
)
inline

Compute integral involving the product of three modified Bessel functions. Useful for scaling the smoothed stochastic source terms in Langevin equations.

Parameters
[in]beta_xArgument in x-direction.
[in]beta_yArgument in y-direction.
[in]beta_zArgument in z-direction.
Returns
Value of the integral.

◆ GetBesselZero()

template<class T >
T RandomToolbox::GetBesselZero ( const T &  x)
inline

Compute modified bessel function of first kind (order 0).

Parameters
[in]xArgument of Bessel funtion.
Returns
Value of Bessel function.

◆ GetHash()

uint64_t RandomToolbox::GetHash ( unsigned long  nodeIndex,
unsigned short  iDim,
unsigned long  timeIter 
)
inline

Generate a deterministic 64-bit hash from three integers.

Parameters
[in]nodeIndexGlobal node index.
[in]iDimDimension index.
[in]timeIterCurrent time iteration of the simulation.
Returns
64-bit hash value.

◆ GetNormal()

double RandomToolbox::GetNormal ( unsigned long  nodeIndex,
unsigned long  dim,
unsigned long  timeIter 
)
inline

Generate a deterministic standard normal number for a cell, dimension, and timestep.

Combines hashing and Box-Muller in one function.

Parameters
[in]nodeIndexGlobal node index.
[in]dimDimension index.
[in]timeIterSimulation timestep (1-based).
Returns
Standard normal random number.

◆ HashToNormal()

double RandomToolbox::HashToNormal ( uint64_t  x)
inline

Generate a standard normal random number from a 64-bit hash. Uses two deterministic uniforms derived from the hash and its bitwise NOT as inputs to the Box-Muller transform.

Parameters
[in]x64-bit hash.
Returns
Standard normal random number (mean=0, stddev=1).

◆ HashToUniform()

double RandomToolbox::HashToUniform ( uint64_t  x)
inline

Convert a 64-bit hash into a uniform double in (0,1]. Uses the top 53 bits of the hash to fill the mantissa of a double. Ensures the result is never zero, suitable for Box-Muller transform.

Parameters
[in]x64-bit hash.
Returns
Uniform double in the interval (0,1].