representation for streams of pseudorandom numbers More...
#include <Stream.hpp>
Public Types | |
typedef EngineType | engine_type |
typedef engine_type::state_type | state_type |
Engine type. More... | |
typedef engine_type::seed_type | seed_type |
Type of RNG state. More... | |
typedef engine_type::advance_type | advance_type |
Type of RNG seed. More... | |
typedef engine_type::init_type | init_type |
Type of RNG displacement. More... | |
typedef DistibutionType | distribution_type |
Type of RNG initializer. More... | |
typedef distribution_type::result_type | result_type |
type of the STL compliant distribution More... | |
typedef random_iterator_tbb::transform_iterator< caller_type, counting_iterator > | iterator |
type of the result More... | |
Public Member Functions | |
Stream ()=delete | |
type of stream iterator More... | |
Stream (distribution_type const &distribution, seed_type seed, uint32_t stream=0) | |
Constructor. More... | |
Stream (Stream< DistibutionType, EngineType > const &other) | |
Copy constructor. More... | |
iterator | begin () const |
Returns an iterator to the first element of the stream. More... | |
iterator | end () const |
Returns an iterator to the past last element of the stream. More... | |
result_type | operator[] (advance_type n) const |
Returns the element at specified location n. More... | |
result_type | operator() (void) |
At each call, this function will produce a pseudorandom number and advance the engine state. More... | |
distribution_type | getDistribution () const |
Get the distribution. More... | |
void | setDistribution (distribution_type dist) |
Set the distribution. More... | |
engine_type | getEngine () const |
Get the associated engine. More... | |
void | setEngine (engine_type engine) |
Set the object's engine. More... | |
const seed_type & | getSeed () const |
Get the seed. More... | |
void | setSeed (const seed_type &seed) |
Set the seed. More... | |
uint32_t | getStream () const |
Get the object's stream number. More... | |
void | setStream (uint32_t stream) |
Set the object's stream number. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Stream< DistibutionType, EngineType > &be) |
Objects of this class represent collections of up to \( {2}^{32} \) streams of random numbers for each seed. Each of such streams has a length of \( {2}^{64} \). If the chosen distribution generates data with 64bits, like double
, then each stream can handle up to 128 ExaByte of data. Stream objects are thread-safe and lazy-evaluated. Output is produced only when requested. It is user responsibility to retrieve and store, if needed, the generated output.
DistibutionType | STL compliant distribution type. For example: std::uniform_real_distribution , std::exponential_distribution . |
EngineType | RNG type. |
There are seven options:
Usage:
1) Direct class instantiation:
2) Using random_iterator::make_stream(...)
:
Definition at line 118 of file Stream.hpp.
typedef engine_type::advance_type random_iterator::Stream< DistibutionType, EngineType >::advance_type |
Definition at line 128 of file Stream.hpp.
typedef DistibutionType random_iterator::Stream< DistibutionType, EngineType >::distribution_type |
Definition at line 131 of file Stream.hpp.
typedef EngineType random_iterator::Stream< DistibutionType, EngineType >::engine_type |
Definition at line 125 of file Stream.hpp.
typedef engine_type::init_type random_iterator::Stream< DistibutionType, EngineType >::init_type |
Definition at line 129 of file Stream.hpp.
typedef random_iterator_tbb::transform_iterator< caller_type, counting_iterator> random_iterator::Stream< DistibutionType, EngineType >::iterator |
Definition at line 134 of file Stream.hpp.
typedef distribution_type::result_type random_iterator::Stream< DistibutionType, EngineType >::result_type |
Definition at line 132 of file Stream.hpp.
typedef engine_type::seed_type random_iterator::Stream< DistibutionType, EngineType >::seed_type |
Definition at line 127 of file Stream.hpp.
typedef engine_type::state_type random_iterator::Stream< DistibutionType, EngineType >::state_type |
Definition at line 126 of file Stream.hpp.
|
delete |
|
inline |
distribution | Distribution with stl compliant interface. |
seed | Seed for pseudorandom number generation. |
stream | Pseudorandom number stream. |
Definition at line 145 of file Stream.hpp.
|
inline |
other |
Definition at line 157 of file Stream.hpp.
|
inline |
Definition at line 168 of file Stream.hpp.
|
inline |
Definition at line 180 of file Stream.hpp.
|
inline |
Definition at line 216 of file Stream.hpp.
|
inline |
Definition at line 234 of file Stream.hpp.
|
inline |
Definition at line 252 of file Stream.hpp.
|
inline |
Definition at line 270 of file Stream.hpp.
|
inline |
DistributionType
Definition at line 206 of file Stream.hpp.
|
inline |
No bounds checking is performed.
n | position in the sequence. |
Definition at line 194 of file Stream.hpp.
|
inline |
dist |
Definition at line 225 of file Stream.hpp.
|
inline |
engine |
Definition at line 243 of file Stream.hpp.
|
inline |
seed |
Definition at line 261 of file Stream.hpp.
|
inline |
stream |
Definition at line 279 of file Stream.hpp.
|
friend |
Definition at line 283 of file Stream.hpp.