Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends

r123::Engine< CBRNG > Struct Template Reference

#include <Random123/conventional/Engine.hpp>

List of all members.

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
typedef size_t elem_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 (uint64_t 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
ukey_type getseed () const
std::pair< ctr_type, elem_typegetcounter () const
void setcounter (const ctr_type &_c, elem_type _elem)

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
ukey_type ukey
ctr_type c
elem_type elem
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 size_t r123::Engine< CBRNG >::elem_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 (  )  [inline, explicit]
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( result_type  r  )  [inline, explicit]
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  )  [inline, explicit]
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( const ukey_type uk  )  [inline, explicit]
template<typename CBRNG >
r123::Engine< CBRNG >::Engine ( ukey_type uk  )  [inline, explicit]

Member Function Documentation

template<typename CBRNG >
void r123::Engine< CBRNG >::discard ( uint64_t  skip  )  [inline]
template<typename CBRNG >
void r123::Engine< CBRNG >::fix_invariant (  )  [inline, protected]
template<typename CBRNG >
std::pair<ctr_type, elem_type> r123::Engine< CBRNG >::getcounter (  )  const [inline]
template<typename CBRNG >
ukey_type r123::Engine< CBRNG >::getseed (  )  const [inline]
template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::operator() ( const ctr_type c  )  const [inline]
template<typename CBRNG >
result_type r123::Engine< CBRNG >::operator() (  )  [inline]
template<typename CBRNG >
static R123_CONSTEXPR result_type min r123::Engine< CBRNG >::R123_NO_MACRO_SUBST (  )  [inline, static]
template<typename CBRNG >
static R123_CONSTEXPR result_type max r123::Engine< CBRNG >::R123_NO_MACRO_SUBST (  )  [inline, static]
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( const ukey_type uk  )  [inline]
template<typename CBRNG >
template<typename SeedSeq >
void r123::Engine< CBRNG >::seed ( SeedSeq &  s  )  [inline]
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( ukey_type uk  )  [inline]
template<typename CBRNG >
void r123::Engine< CBRNG >::seed ( result_type  r  )  [inline]
template<typename CBRNG >
void r123::Engine< CBRNG >::seed (  )  [inline]
template<typename CBRNG >
void r123::Engine< CBRNG >::setcounter ( const ctr_type _c,
elem_type  _elem 
) [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 >
elem_type r123::Engine< CBRNG >::elem [protected]
template<typename CBRNG >
key_type r123::Engine< CBRNG >::key [protected]
template<typename CBRNG >
ukey_type r123::Engine< CBRNG >::ukey [protected]
template<typename CBRNG >
ctr_type r123::Engine< CBRNG >::v [protected]

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines