Celeritas 0.7.0-dev.228+develop.9905a715
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
celeritas::RanluxppRngEngine Class Reference

Implements the RANLUX++ random number generator engine with modifications. More...

#include <RanluxppRngEngine.hh>

Public Types

using result_type = std::uint32_t
 Public types.
 
using Initializer_t = RanluxppInitializer
 
using ParamsRef = NativeCRef< RanluxppRngParamsData >
 
using StateRef = NativeRef< RanluxppRngStateData >
 

Public Member Functions

CELER_FUNCTION RanluxppRngEngine (ParamsRef const &params, StateRef const &state, TrackSlotId tid)
 Instantiate with optional default seed.
 
CELER_FUNCTION RanluxppRngEngineoperator= (Initializer_t const &init)
 Initialize state for the given seed and subsequence.
 
CELER_FUNCTION result_type operator() ()
 Return the next random bits, generating a new block if necessary.
 
CELER_FUNCTION void discard (RanluxppUInt count)
 Skip n random numbers without generating them.
 

Static Public Member Functions

static CELER_CONSTEXPR_FUNCTION result_type min ()
 Lowest value potentially generated.
 
static CELER_CONSTEXPR_FUNCTION result_type max ()
 Highest value potentially generated.
 

Detailed Description

Implements the RANLUX++ random number generator engine with modifications.

This implementation of RANLUX++ (sibidanov-revisionsubtractwithborrow-2017) is based directly on the implementation of hahnfeld-ranlux-2021. The RANLUX++ algorithm is an optimization of the RANLUX generator (james-ranluxfortran-1994), based on work by Luscher's modification (luscher-portablehighquality-1994) of Marsaglia and Zaman's RCARRY (james-reviewpseudorandom-1990). As discussed in the RANLUX theory paper, the algorithm is essentially a linear congruential generator (LCG) with a huge state.

The underlying RCARRY algorithm used an array of 24 24-bit integer words, which with today's large integer sizes can be written as 9 64-bit integers. A given state is used to extract 12 samples, and the lower 32 bits of each is used as entropy.

Todo:
The decision to discard the high bits rather than the low bits from each word is likely undesirable at least for the last number in the state, since it is known that LCG integers have highly correlated sequential LSBs. Also instead, the class could be adapted to provide 18 32-bit samples instead of discarding 16 out of every 48 bits.

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