/search.css" rel="stylesheet" type="text/css"/> /search.js">
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
r123::Engine< CBRNG > Struct Template Reference

#include <Random123/conventional/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 (const Engine &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 (const ukey_type &uk)
 
 Engine (ukey_type &uk)
 
void seed (const ukey_type &uk)
 
void seed (ukey_type &uk)
 
ctr_type operator() (const ctr_type &c) const
 
key_type getkey () const
 
void setkey (const key_type &k)
 
std::pair< ctr_type, result_typegetcounter () const
 
void setcounter (const ctr_type &_c, result_type _elem)
 
void setcounter (const std::pair< ctr_type, result_type > &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== (const Engine &lhs, const Engine &rhs)
 
bool operator!= (const Engine &lhs, const Engine &rhs)
 
std::ostream & operator<< (std::ostream &os, const Engine &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++0x "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++0x random number engines.

The MicroURNG template in MicroURNG.hpp provides the more limited functionality of a C++0x "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++0x "Random Number Distributions" without giving up control over the counters and keys.

Member Typedef Documentation

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

Constructor & Destructor Documentation

template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( )
inlineexplicit
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( result_type  r)
inlineexplicit
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( Engine< CBRNG > &  e)
inline
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( const Engine< CBRNG > &  e)
inline
template<typename CBRNG >
template<typename SeedSeq >
r123::Engine< CBRNG >::Engine ( SeedSeq &  s)
inlineexplicit
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( const ukey_type uk)
inlineexplicit
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( ukey_type uk)
inlineexplicit

Member Function Documentation

template<typename CBRNG >
void r123::Engine< CBRNG >::discard ( R123_ULONG_LONG  skip)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::fix_invariant ( )
inlineprotected
template<typename CBRNG >
std::pair<ctr_type, result_type> r123::Engine< CBRNG >::getcounter ( ) const
inline
template<typename CBRNG >
key_type r123::Engine< CBRNG >::getkey ( ) const
inline
template<typename CBRNG >
result_type r123::Engine< CBRNG >::operator() ( )
inline
template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::operator() ( const ctr_type c) const
inline
template<typename CBRNG >
static R123_CONSTEXPR result_type min r123::Engine< CBRNG >::R123_NO_MACRO_SUBST ( )
inlinestatic
template<typename CBRNG >
static R123_CONSTEXPR result_type max r123::Engine< CBRNG >::R123_NO_MACRO_SUBST ( )
inlinestatic
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( result_type  r)
inline
template<typename CBRNG >
template<typename SeedSeq >
void r123::Engine< CBRNG >::seed ( SeedSeq &  s)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( )
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( const ukey_type uk)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( ukey_type uk)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::setcounter ( const ctr_type _c,
result_type  _elem 
)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::setcounter ( const std::pair< ctr_type, result_type > &  ce)
inline
template<typename CBRNG >
void r123::Engine< CBRNG >::setkey ( const key_type k)
inline

Friends And Related Function Documentation

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

Member Data Documentation

template<typename CBRNG >
const result_type r123::Engine< CBRNG >::_Max = ~((result_type)0)
static
template<typename CBRNG >
const result_type r123::Engine< CBRNG >::_Min = 0
static
template<typename CBRNG >
cbrng_type r123::Engine< CBRNG >::b
protected
template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::c
protected
template<typename CBRNG >
key_type r123::Engine< CBRNG >::key
protected
template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::v
protected

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