CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
random_iterator_r123::Engine< CBRNG > Struct Template Reference

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. More...

#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 (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 (RANDOM_ITERATOR_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_type > getcounter () const
 
void setcounter (const ctr_type &_c, result_type _elem)
 
void setcounter (const std::pair< ctr_type, result_type > &ce)
 

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 random_iterator_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.


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