BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::MixMaxEngine< N, SkipNumber > Class Template Reference

Description

template<int N, int SkipNumber>
class ROOT::Math::MixMaxEngine< N, SkipNumber >

     MixMaxEngine is a wrapper class for the MIXMAX Random number generator.
     MIXMAX is a matrix-recursive random number generator introduced by
     G. Savvidy.

     The real implementation of the generator, written in C, is in the mixmax.h and mixmax.cxx files.
     This generator code is available also at hepforge: http://mixmax.hepforge.org
     The MIXMAX code has been created and developed by Konstantin Savvidy and it is 
     released under GNU Lesser General Public License v3.

     This wrapper class provides 3 different variants of MIXMAX according to the template para extra parameter N. 
     The extra parameter, `SkipNumber`, is used to perform additional iterations of the generator before returning the random numbers. 
       For example, when `SkipNumber = 2`, the generator will have two extra iterations that will be discarder. 

        MIXMAX with N = 240. This is a new version of  the generator (version 2.0beta)  described in the 
        <a href="http://dx.doi.org/10.1016/j.chaos.2016.05.003">2016 paper</a> (3rd reference), with 
        special number $s=487013230256099140$, $m=2^{51}+1$ and having a period of $10^{4389}$. 

        MIXMAX with N = 17, from the 2.0beta version with $s=0$ and $m=2^{36}+1$. The period of the generator is $10^{294}$. 

        MIXMAX with N = 256 from the 1.0 version. The period is (for `SkipNumber=0`) $10^{4682}$. 
        For this generator we recommend in ROOT using a default value of `SkipNumber=2, while for the previous two generators 
        skipping is not needed. 

        This table describes the properties of the MIXMAX generators. MIXMAX is a genuine 61 bit generator on the Galois field GF[p], where
       $p=2^{61}-1$ is the Mersenne prime number.
      The MIXMAX generators with these parameters pass all of the BigCrush
      tests in the <a href="http://simul.iro.umontreal.ca/testu01/tu01.html">TestU01 suite</a\>.
     The References for MIXMAX are 

        G.K.Savvidy and N.G.Ter-Arutyunian, *On the Monte Carlo simulation of physical systems,
     J.Comput.Phys. 97, 566 (1991)*;
     Preprint EPI-865-16-86, Yerevan, Jan. 1986

        K.Savvidy, *The MIXMAX random number generator*, 
     Comp. Phys. Commun. 196 (2015), pp 161–165
     http://dx.doi.org/10.1016/j.cpc.2015.06.003

        K.Savvidy and G.Savvidy, *Spectrum and Entropy of C-systems MIXMAX Random Number Generator*,
     Chaos, Solitons & Fractals, Volume 91, (2016) pp. 33–38
     http://dx.doi.org/10.1016/j.chaos.2016.05.003


     @ingroup Random

Definition at line 114 of file MixMaxEngine.h.

Inheritance diagram for ROOT::Math::MixMaxEngine< N, SkipNumber >:
[legend]
Collaboration diagram for ROOT::Math::MixMaxEngine< N, SkipNumber >:
[legend]

Public Types

typedef TRandomEngine BaseType
 
typedef uint64_t Result_t
 
typedef uint64_t StateInt_t
 

Public Member Functions

 MixMaxEngine (uint64_t seed=1)
 
virtual ~MixMaxEngine ()
 
Result_t IntRndm ()
 generate a 64 bit integer number More...
 
double operator() ()
 generate a double random number (faster interface) More...
 
virtual double Rndm ()
 
void RndmArray (int n, double *array)
 generate an array of random numbers More...
 
void SetSeed (Result_t seed)
 set the generator seed More...
 

Static Public Member Functions

static uint64_t MaxInt ()
 maximum integer that can be generated. For MIXMAX is 2^61-1 More...
 
static uint64_t MinInt ()
 minimum integer that can be generated. For MIXMAX is 0 More...
 
static std::string Name ()
 get name of the generator More...
 
static int Size ()
 Get the size of the generator. More...
 

Protected Member Functions

int Counter () const
 Get the counter (between 0 and Size-1) More...
 
void GetState (std::vector< StateInt_t > &state) const
 get the state of the generator More...
 
void SetState (const std::vector< StateInt_t > &state)
 set the full initial generator state More...
 

Private Member Functions

double Rndm_impl ()
 implementation function to generate the random number More...
 

Private Attributes

MixMaxEngineImpl< N > * fRng
 

Member Typedef Documentation

◆ BaseType

template<int N, int SkipNumber>
typedef TRandomEngine ROOT::Math::MixMaxEngine< N, SkipNumber >::BaseType

Definition at line 118 of file MixMaxEngine.h.

◆ Result_t

template<int N, int SkipNumber>
typedef uint64_t ROOT::Math::MixMaxEngine< N, SkipNumber >::Result_t

Definition at line 126 of file MixMaxEngine.h.

◆ StateInt_t

template<int N, int SkipNumber>
typedef uint64_t ROOT::Math::MixMaxEngine< N, SkipNumber >::StateInt_t

Definition at line 122 of file MixMaxEngine.h.

Constructor & Destructor Documentation

◆ MixMaxEngine()

template<int N, int SkipNumber>
ROOT::Math::MixMaxEngine< N, SkipNumber >::MixMaxEngine ( uint64_t  seed = 1)

◆ ~MixMaxEngine()

template<int N, int SkipNumber>
virtual ROOT::Math::MixMaxEngine< N, SkipNumber >::~MixMaxEngine ( )
virtual

Member Function Documentation

◆ Counter()

template<int N, int SkipNumber>
int ROOT::Math::MixMaxEngine< N, SkipNumber >::Counter ( ) const
protected

Get the counter (between 0 and Size-1)

◆ GetState()

template<int N, int SkipNumber>
void ROOT::Math::MixMaxEngine< N, SkipNumber >::GetState ( std::vector< StateInt_t > &  state) const
protected

get the state of the generator

◆ IntRndm()

template<int N, int SkipNumber>
Result_t ROOT::Math::MixMaxEngine< N, SkipNumber >::IntRndm ( )

generate a 64 bit integer number

◆ MaxInt()

template<int N, int SkipNumber>
static uint64_t ROOT::Math::MixMaxEngine< N, SkipNumber >::MaxInt ( )
static

maximum integer that can be generated. For MIXMAX is 2^61-1

◆ MinInt()

template<int N, int SkipNumber>
static uint64_t ROOT::Math::MixMaxEngine< N, SkipNumber >::MinInt ( )
static

minimum integer that can be generated. For MIXMAX is 0

◆ Name()

template<int N, int SkipNumber>
static std::string ROOT::Math::MixMaxEngine< N, SkipNumber >::Name ( )
static

get name of the generator

◆ operator()()

template<int N, int SkipNumber>
double ROOT::Math::MixMaxEngine< N, SkipNumber >::operator() ( )
inline

generate a double random number (faster interface)

Definition at line 150 of file MixMaxEngine.h.

150 { return Rndm_impl(); }
double Rndm_impl()
implementation function to generate the random number

References ROOT::Math::MixMaxEngine< N, SkipNumber >::Rndm_impl().

Here is the call graph for this function:

◆ Rndm()

template<int N, int SkipNumber>
virtual double ROOT::Math::MixMaxEngine< N, SkipNumber >::Rndm ( )
inlinevirtual

Implements ROOT::Math::TRandomEngine.

Definition at line 147 of file MixMaxEngine.h.

147 { return Rndm_impl(); }

References ROOT::Math::MixMaxEngine< N, SkipNumber >::Rndm_impl().

Here is the call graph for this function:

◆ Rndm_impl()

template<int N, int SkipNumber>
double ROOT::Math::MixMaxEngine< N, SkipNumber >::Rndm_impl ( )
private

implementation function to generate the random number

Referenced by ROOT::Math::MixMaxEngine< N, SkipNumber >::operator()(), and ROOT::Math::MixMaxEngine< N, SkipNumber >::Rndm().

◆ RndmArray()

template<int N, int SkipNumber>
void ROOT::Math::MixMaxEngine< N, SkipNumber >::RndmArray ( int  n,
double *  array 
)

generate an array of random numbers

◆ SetSeed()

template<int N, int SkipNumber>
void ROOT::Math::MixMaxEngine< N, SkipNumber >::SetSeed ( Result_t  seed)

set the generator seed

◆ SetState()

template<int N, int SkipNumber>
void ROOT::Math::MixMaxEngine< N, SkipNumber >::SetState ( const std::vector< StateInt_t > &  state)
protected

set the full initial generator state

◆ Size()

template<int N, int SkipNumber>
static int ROOT::Math::MixMaxEngine< N, SkipNumber >::Size ( )
static

Get the size of the generator.

Member Data Documentation

◆ fRng

template<int N, int SkipNumber>
MixMaxEngineImpl<N>* ROOT::Math::MixMaxEngine< N, SkipNumber >::fRng
private

Definition at line 182 of file MixMaxEngine.h.


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