Project Alice
Loading...
Searching...
No Matches
r123::Engine< CBRNG > Struct Template Reference

#include <Engine.hpp>

Public Types

typedef CBRNG cbrng_type
 
typedef CBRNG::ctr_type ctr_type
 
typedef CBRNG::key_type key_type
 
typedef CBRNG::ukey_type ukey_type
 
typedef ctr_type::value_type result_type
 

Public Member Functions

 Engine ()
 
 Engine (result_type r)
 
 Engine (Engine &e)
 
 Engine (Engine const &e)
 
template<typename SeedSeq >
 Engine (SeedSeq &s)
 
void seed (result_type r)
 
template<typename SeedSeq >
void seed (SeedSeq &s)
 
void seed ()
 
result_type operator() ()
 
void discard (R123_ULONG_LONG skip)
 
 Engine (ukey_type const &uk)
 
 Engine (ukey_type &uk)
 
void seed (ukey_type const &uk)
 
void seed (ukey_type &uk)
 
ctr_type operator() (ctr_type const &c) const
 
key_type getkey () const
 
void setkey (key_type const &k)
 
std::pair< ctr_type, result_typegetcounter () const
 
void setcounter (ctr_type const &_c, result_type _elem)
 
void setcounter (std::pair< ctr_type, result_type > const &ce)
 

Static Public Member Functions

static R123_CONSTEXPR result_type min R123_NO_MACRO_SUBST ()
 
static R123_CONSTEXPR result_type max R123_NO_MACRO_SUBST ()
 

Static Public Attributes

static const result_type _Min = 0
 
static const result_type _Max = ~((result_type)0)
 

Protected Member Functions

void fix_invariant ()
 

Protected Attributes

cbrng_type b
 
key_type key
 
ctr_type c
 
ctr_type v
 

Friends

bool operator== (Engine const &lhs, Engine const &rhs)
 
bool operator!= (Engine const &lhs, Engine const &rhs)
 
std::ostream & operator<< (std::ostream &os, Engine const &be)
 
std::istream & operator>> (std::istream &is, Engine &be)
 

Detailed Description

template<typename CBRNG>
struct r123::Engine< CBRNG >

If G satisfies the requirements of a CBRNG, and has a ctr_type whose value_type is an unsigned integral type, then Engine<G> satisfies the requirements of a C++11 "Uniform Random Number Engine" and can be used in any context where such an object is expected.

Note that wrapping a counter based RNG with a traditional API in this way obscures much of the power of counter based PRNGs. Nevertheless, it may be of value in applications that are already coded to work with the C++11 random number engines.

The MicroURNG template in MicroURNG.hpp provides the more limited functionality of a C++11 "Uniform Random Number Generator", but leaves the application in control of counters and keys and hence may be preferable to the Engine template. For example, a MicroURNG allows one to use C++11 "Random Number Distributions" without giving up control over the counters and keys.

Definition at line 68 of file Engine.hpp.

Member Typedef Documentation

◆ cbrng_type

template<typename CBRNG >
typedef CBRNG r123::Engine< CBRNG >::cbrng_type

Definition at line 69 of file Engine.hpp.

◆ ctr_type

template<typename CBRNG >
typedef CBRNG::ctr_type r123::Engine< CBRNG >::ctr_type

Definition at line 70 of file Engine.hpp.

◆ key_type

template<typename CBRNG >
typedef CBRNG::key_type r123::Engine< CBRNG >::key_type

Definition at line 71 of file Engine.hpp.

◆ result_type

template<typename CBRNG >
typedef ctr_type::value_type r123::Engine< CBRNG >::result_type

Definition at line 73 of file Engine.hpp.

◆ ukey_type

template<typename CBRNG >
typedef CBRNG::ukey_type r123::Engine< CBRNG >::ukey_type

Definition at line 72 of file Engine.hpp.

Constructor & Destructor Documentation

◆ Engine() [1/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( )
inlineexplicit

Definition at line 90 of file Engine.hpp.

Here is the caller graph for this function:

◆ Engine() [2/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( result_type  r)
inlineexplicit

Definition at line 95 of file Engine.hpp.

◆ Engine() [3/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( Engine< CBRNG > &  e)
inline

Definition at line 112 of file Engine.hpp.

Here is the call graph for this function:

◆ Engine() [4/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( Engine< CBRNG > const &  e)
inline

Definition at line 116 of file Engine.hpp.

Here is the call graph for this function:

◆ Engine() [5/7]

template<typename CBRNG >
template<typename SeedSeq >
r123::Engine< CBRNG >::Engine ( SeedSeq &  s)
inlineexplicit

Definition at line 126 of file Engine.hpp.

◆ Engine() [6/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( ukey_type const &  uk)
inlineexplicit

Definition at line 224 of file Engine.hpp.

◆ Engine() [7/7]

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( ukey_type uk)
inlineexplicit

Definition at line 227 of file Engine.hpp.

Member Function Documentation

◆ discard()

template<typename CBRNG >
void r123::Engine< CBRNG >::discard ( R123_ULONG_LONG  skip)
inline

Definition at line 203 of file Engine.hpp.

Here is the call graph for this function:

◆ fix_invariant()

template<typename CBRNG >
void r123::Engine< CBRNG >::fix_invariant ( )
inlineprotected

Definition at line 81 of file Engine.hpp.

Here is the caller graph for this function:

◆ getcounter()

template<typename CBRNG >
std::pair< ctr_type, result_type > r123::Engine< CBRNG >::getcounter ( ) const
inline

Definition at line 271 of file Engine.hpp.

◆ getkey()

template<typename CBRNG >
key_type r123::Engine< CBRNG >::getkey ( ) const
inline

Definition at line 256 of file Engine.hpp.

◆ operator()() [1/2]

template<typename CBRNG >
result_type r123::Engine< CBRNG >::operator() ( )
inline

Definition at line 190 of file Engine.hpp.

◆ operator()() [2/2]

template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::operator() ( ctr_type const &  c) const
inline

Definition at line 252 of file Engine.hpp.

◆ R123_NO_MACRO_SUBST() [1/2]

template<typename CBRNG >
static R123_CONSTEXPR result_type min r123::Engine< CBRNG >::R123_NO_MACRO_SUBST ( )
inlinestatic

Definition at line 183 of file Engine.hpp.

◆ R123_NO_MACRO_SUBST() [2/2]

template<typename CBRNG >
static R123_CONSTEXPR result_type max r123::Engine< CBRNG >::R123_NO_MACRO_SUBST ( )
inlinestatic

Definition at line 186 of file Engine.hpp.

◆ seed() [1/5]

template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( )
inline

Definition at line 149 of file Engine.hpp.

Here is the call graph for this function:

◆ seed() [2/5]

template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( result_type  r)
inline

Definition at line 137 of file Engine.hpp.

Here is the call graph for this function:

◆ seed() [3/5]

template<typename CBRNG >
template<typename SeedSeq >
void r123::Engine< CBRNG >::seed ( SeedSeq &  s)
inline

Definition at line 141 of file Engine.hpp.

Here is the call graph for this function:

◆ seed() [4/5]

template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( ukey_type uk)
inline

Definition at line 233 of file Engine.hpp.

Here is the call graph for this function:

◆ seed() [5/5]

template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( ukey_type const &  uk)
inline

Definition at line 230 of file Engine.hpp.

Here is the call graph for this function:

◆ setcounter() [1/2]

template<typename CBRNG >
void r123::Engine< CBRNG >::setcounter ( ctr_type const &  _c,
result_type  _elem 
)
inline

Definition at line 276 of file Engine.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setcounter() [2/2]

template<typename CBRNG >
void r123::Engine< CBRNG >::setcounter ( std::pair< ctr_type, result_type > const &  ce)
inline

Definition at line 285 of file Engine.hpp.

Here is the call graph for this function:

◆ setkey()

template<typename CBRNG >
void r123::Engine< CBRNG >::setkey ( key_type const &  k)
inline

Definition at line 263 of file Engine.hpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

template<typename CBRNG >
bool operator!= ( Engine< CBRNG > const &  lhs,
Engine< CBRNG > const &  rhs 
)
friend

Definition at line 155 of file Engine.hpp.

◆ operator<<

template<typename CBRNG >
std::ostream & operator<< ( std::ostream &  os,
Engine< CBRNG > const &  be 
)
friend

Definition at line 159 of file Engine.hpp.

◆ operator==

template<typename CBRNG >
bool operator== ( Engine< CBRNG > const &  lhs,
Engine< CBRNG > const &  rhs 
)
friend

Definition at line 152 of file Engine.hpp.

◆ operator>>

template<typename CBRNG >
std::istream & operator>> ( std::istream &  is,
Engine< CBRNG > &  be 
)
friend

Definition at line 163 of file Engine.hpp.

Member Data Documentation

◆ _Max

template<typename CBRNG >
const result_type r123::Engine< CBRNG >::_Max = ~((result_type)0)
static

Definition at line 181 of file Engine.hpp.

◆ _Min

template<typename CBRNG >
const result_type r123::Engine< CBRNG >::_Min = 0
static

Definition at line 180 of file Engine.hpp.

◆ b

template<typename CBRNG >
cbrng_type r123::Engine< CBRNG >::b
protected

Definition at line 76 of file Engine.hpp.

◆ c

template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::c
protected

Definition at line 78 of file Engine.hpp.

◆ key

template<typename CBRNG >
key_type r123::Engine< CBRNG >::key
protected

Definition at line 77 of file Engine.hpp.

◆ v

template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::v
protected

Definition at line 79 of file Engine.hpp.


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