Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::random::InversiveCongruential< IntType, a, c, m, val > Class Template Reference

#include <arcane/core/random/InversiveCongruential.h>

Collaboration diagram for Arcane::random::InversiveCongruential< IntType, a, c, m, val >:

Public Types

typedef IntType result_type

Public Member Functions

result_type min () const
 Returns the minimum possible value of a sequence.
result_type max () const
 Returns the maximum possible value of a sequence.
 InversiveCongruential (IntType x0=1)
 Constructor with seed initialization from the value x0.
void seed (IntType x0)
 Initialization of the generator seed from the value x0.
IntType getState () const
 Method that returns the generator state.
IntType operator() ()
 Overriding the operator () which returns the pseudo random value of the generator. The generator state is modified.
bool validation (IntType x) const
 Validation function (I don't really know what it is for!).
bool operator== (const InversiveCongruential &rhs) const
 Overriding the == operator.

Static Public Member Functions

static IntType apply (IntType x)
 Returns the pseudo-random value from the state x. The private member _x of the generator is not used and is not
modified.

Static Public Attributes

static const bool has_fixed_range = true
static const result_type min_value = (c == 0 ? 1 : 0)
static const result_type max_value = m - 1

Private Attributes

IntType _x

Detailed Description

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
class Arcane::random::InversiveCongruential< IntType, a, c, m, val >

Class pattern InversiveCongruential. It allows defining classes of the Inversive Congruential type based on the parameters a, c, and m. The generated pseudo-random numbers are of type IntType.

The generation of a sequence of pseudo-random numbers is done:

  • either by successive calls to the operator (). In this case, the seed can
    be initialized by calling the constructor or the different methods
    seed. The generator state is managed internally via the
    private member _x. Its value is accessible via the getState() method.
  • or by calling the method apply(x). The generator state x is managed outside the class. The seed and getState() methods are meaningless in this usage.

Definition at line 49 of file InversiveCongruential.h.

Member Typedef Documentation

◆ result_type

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
typedef IntType Arcane::random::InversiveCongruential< IntType, a, c, m, val >::result_type

Definition at line 53 of file InversiveCongruential.h.

Constructor & Destructor Documentation

◆ InversiveCongruential()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
Arcane::random::InversiveCongruential< IntType, a, c, m, val >::InversiveCongruential ( IntType x0 = 1)
inlineexplicit

Constructor with seed initialization from the value x0.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 87 of file InversiveCongruential.h.

Member Function Documentation

◆ apply()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
IntType Arcane::random::InversiveCongruential< IntType, a, c, m, val >::apply ( IntType x)
inlinestatic

Returns the pseudo-random value from the state x. The private member _x of the generator is not used and is not
modified.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 137 of file InversiveCongruential.h.

Referenced by Arcane::random::InversiveCongruential< Int32, 9102, 2147483647 - 36884165, 2147483647, 0 >::operator()().

Here is the caller graph for this function:

◆ getState()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
IntType Arcane::random::InversiveCongruential< IntType, a, c, m, val >::getState ( ) const
inline

Method that returns the generator state.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 110 of file InversiveCongruential.h.

◆ max()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
result_type Arcane::random::InversiveCongruential< IntType, a, c, m, val >::max ( ) const
inline

Returns the maximum possible value of a sequence.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 76 of file InversiveCongruential.h.

◆ min()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
result_type Arcane::random::InversiveCongruential< IntType, a, c, m, val >::min ( ) const
inline

Returns the minimum possible value of a sequence.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 66 of file InversiveCongruential.h.

◆ operator()()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
IntType Arcane::random::InversiveCongruential< IntType, a, c, m, val >::operator() ( )
inline

Overriding the operator () which returns the pseudo random value of the generator. The generator state is modified.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 121 of file InversiveCongruential.h.

◆ operator==()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
bool Arcane::random::InversiveCongruential< IntType, a, c, m, val >::operator== ( const InversiveCongruential< IntType, a, c, m, val > & rhs) const
inline

Overriding the == operator.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 161 of file InversiveCongruential.h.

◆ seed()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
void Arcane::random::InversiveCongruential< IntType, a, c, m, val >::seed ( IntType x0)
inline

Initialization of the generator seed from the value x0.

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 100 of file InversiveCongruential.h.

◆ validation()

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
bool Arcane::random::InversiveCongruential< IntType, a, c, m, val >::validation ( IntType x) const
inline

Validation function (I don't really know what it is for!).

Author
Patrick Rathouit (origine bibliotheque BOOST)
Date
28/07/2006

Definition at line 151 of file InversiveCongruential.h.

Member Data Documentation

◆ _x

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
IntType Arcane::random::InversiveCongruential< IntType, a, c, m, val >::_x
private

Definition at line 168 of file InversiveCongruential.h.

◆ has_fixed_range

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
const bool Arcane::random::InversiveCongruential< IntType, a, c, m, val >::has_fixed_range = true
static

Definition at line 54 of file InversiveCongruential.h.

◆ max_value

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
const result_type Arcane::random::InversiveCongruential< IntType, a, c, m, val >::max_value = m - 1
static

Definition at line 56 of file InversiveCongruential.h.

◆ min_value

template<typename IntType, IntType a, IntType c, IntType m, IntType val>
const result_type Arcane::random::InversiveCongruential< IntType, a, c, m, val >::min_value = (c == 0 ? 1 : 0)
static

Definition at line 55 of file InversiveCongruential.h.


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