Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::RanluxppEngine< p > Class Template Referencefinal

template<int p>
class ROOT::Math::RanluxppEngine< p >

Implementation of the RANLUX++ generator.

RANLUX++ is an LCG equivalent of RANLUX using 576 bit numbers.

The idea of the generator (such as the initialization method) and the algorithm for the modulo operation are described in A. Sibidanov, A revision of the subtract-with-borrow random numbergenerators, Computer Physics Communications*, 221(2017), 299-303, preprint https://arxiv.org/pdf/1705.03123.pdf

The code is loosely based on the Assembly implementation by A. Sibidanov available at https://github.com/sibidanov/ranluxpp/.

Compared to the original generator, this implementation contains a fix to ensure that the modulo operation of the LCG always returns the smallest value congruent to the modulus (based on notes by M. Lüscher). Also, the generator converts the LCG state back to RANLUX numbers (implementation based on notes by M. Lüscher). This avoids a bias in the generated numbers because the upper bits of the LCG state, that is smaller than the modulus \( m = 2^{576} - 2^{240} + 1 \) (not a power of 2!), have a higher probability of being 0 than 1. And finally, this implementation draws 48 random bits for each generated floating point number (instead of 52 bits as in the original generator) to maintain the theoretical properties from understanding the original transition function of RANLUX as a chaotic dynamical system.

Definition at line 27 of file RanluxppEngine.h.

Public Member Functions

 RanluxppEngine (uint64_t seed=314159265)
 
 ~RanluxppEngine () override
 
uint64_t IntRndm ()
 Generate a random integer value with 48 bits.
 
double operator() ()
 Generate a double-precision random number (non-virtual method)
 
double Rndm () override
 Generate a double-precision random number with 48 bits of randomness.
 
void SetSeed (uint64_t seed)
 Initialize and seed the state of the generator.
 
void Skip (uint64_t n)
 Skip n random numbers without generating them.
 
- Public Member Functions inherited from ROOT::Math::TRandomEngine
virtual ~TRandomEngine ()
 

Static Public Member Functions

static const char * Name ()
 Get name of the generator.
 

Private Types

using ImplType = RanluxppEngineImpl< 48, p >
 

Private Attributes

std::unique_ptr< ImplTypefImpl
 

#include <Math/RanluxppEngine.h>

Inheritance diagram for ROOT::Math::RanluxppEngine< p >:
[legend]

Member Typedef Documentation

◆ ImplType

template<int p>
using ROOT::Math::RanluxppEngine< p >::ImplType = RanluxppEngineImpl<48, p>
private

Definition at line 30 of file RanluxppEngine.h.

Constructor & Destructor Documentation

◆ RanluxppEngine()

template<int p>
ROOT::Math::RanluxppEngine< p >::RanluxppEngine ( uint64_t  seed = 314159265)

Definition at line 402 of file RanluxppEngineImpl.cxx.

◆ ~RanluxppEngine()

template<int p>
ROOT::Math::RanluxppEngine< p >::~RanluxppEngine ( )
overridedefault

Member Function Documentation

◆ IntRndm()

template<int p>
uint64_t ROOT::Math::RanluxppEngine< p >::IntRndm

Generate a random integer value with 48 bits.

Definition at line 423 of file RanluxppEngineImpl.cxx.

◆ Name()

template<int p>
static const char * ROOT::Math::RanluxppEngine< p >::Name ( )
inlinestatic

Get name of the generator.

Definition at line 50 of file RanluxppEngine.h.

◆ operator()()

template<int p>
double ROOT::Math::RanluxppEngine< p >::operator()

Generate a double-precision random number (non-virtual method)

Definition at line 417 of file RanluxppEngineImpl.cxx.

◆ Rndm()

template<int p>
double ROOT::Math::RanluxppEngine< p >::Rndm
overridevirtual

Generate a double-precision random number with 48 bits of randomness.

Implements ROOT::Math::TRandomEngine.

Definition at line 411 of file RanluxppEngineImpl.cxx.

◆ SetSeed()

template<int p>
void ROOT::Math::RanluxppEngine< p >::SetSeed ( uint64_t  seed)

Initialize and seed the state of the generator.

Definition at line 429 of file RanluxppEngineImpl.cxx.

◆ Skip()

template<int p>
void ROOT::Math::RanluxppEngine< p >::Skip ( uint64_t  n)

Skip n random numbers without generating them.

Definition at line 435 of file RanluxppEngineImpl.cxx.

Member Data Documentation

◆ fImpl

template<int p>
std::unique_ptr<ImplType> ROOT::Math::RanluxppEngine< p >::fImpl
private

Definition at line 31 of file RanluxppEngine.h.

  • math/mathcore/inc/Math/RanluxppEngine.h
  • math/mathcore/src/RanluxppEngineImpl.cxx