Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::random::rand48 Class Reference

Class rand48 models a . More...

#include <linear_congruential.hpp>

Public Types

typedef boost::uint32_t result_type
 

Public Member Functions

 BOOST_STATIC_CONSTANT (bool, has_fixed_range=false)
 
 rand48 ()
 Seeds the generator with the default seed. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR (rand48, result_type, x0)
 Constructs a generator with x(0) := (x0 << 16) | 0x330e. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR (rand48, SeedSeq, seq)
 Seeds the generator with values produced by seq.generate(). More...
 
template<class It >
 rand48 (It &first, It last)
 Seeds the generator using values from an iterator range, and updates first to point one past the last value consumed. More...
 
void seed ()
 Seeds the generator with the default seed. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_SEED (rand48, result_type, x0)
 Changes the current value x(n) of the generator to (x0 << 16) | 0x330e. More...
 
template<class It >
void seed (It &first, It last)
 Seeds the generator using values from an iterator range, and updates first to point one past the last value consumed. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_SEED (rand48, SeedSeq, seq)
 Seeds the generator with values produced by seq.generate(). More...
 
uint32_t operator() ()
 Returns the next value of the generator. More...
 
void discard (boost::uintmax_t z)
 Advances the state of the generator by z. More...
 
template<class Iter >
void generate (Iter first, Iter last)
 Fills a range with random values. More...
 

Static Public Member Functions

static uint32_t min BOOST_PREVENT_MACRO_SUBSTITUTION ()
 Returns the smallest value that the generator can produce. More...
 
static uint32_t max BOOST_PREVENT_MACRO_SUBSTITUTION ()
 Returns the largest value that the generator can produce. More...
 

Friends

template<class CharT , class Traits >
std::basic_ostream< CharT,
Traits > & 
operator<< (std::basic_ostream< CharT, Traits > &os, const rand48 &r)
 Writes a rand48 to a std::ostream. More...
 
template<class CharT , class Traits >
std::basic_istream< CharT,
Traits > & 
operator>> (std::basic_istream< CharT, Traits > &is, rand48 &r)
 Reads a rand48 from a std::istream. More...
 
bool operator== (const rand48 &x, const rand48 &y)
 Returns true if the two generators will produce identical sequences of values. More...
 
bool operator!= (const rand48 &x, const rand48 &y)
 Returns true if the two generators will produce different sequences of values. More...
 

Detailed Description

Class rand48 models a .

It uses the linear congruential algorithm with the parameters a = 0x5DEECE66D, c = 0xB, m = 2**48. It delivers identical results to the lrand48() function available on some systems (assuming lcong48 has not been called).

It is only available on systems where uint64_t is provided as an integral type, so that for example static in-class constants and/or enum definitions with large uint64_t numbers work.

Member Typedef Documentation

typedef boost::uint32_t boost::random::rand48::result_type

Constructor & Destructor Documentation

boost::random::rand48::rand48 ( )
inline

Seeds the generator with the default seed.

template<class It >
boost::random::rand48::rand48 ( It &  first,
It  last 
)
inline

Seeds the generator using values from an iterator range, and updates first to point one past the last value consumed.

Member Function Documentation

static uint32_t min boost::random::rand48::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the smallest value that the generator can produce.

static uint32_t max boost::random::rand48::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the largest value that the generator can produce.

boost::random::rand48::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR ( rand48  ,
result_type  ,
x0   
)
inline

Constructs a generator with x(0) := (x0 << 16) | 0x330e.

References seed().

boost::random::rand48::BOOST_RANDOM_DETAIL_ARITHMETIC_SEED ( rand48  ,
result_type  ,
x0   
)
inline

Changes the current value x(n) of the generator to (x0 << 16) | 0x330e.

boost::random::rand48::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR ( rand48  ,
SeedSeq  ,
seq   
)
inline

Seeds the generator with values produced by seq.generate().

References seed().

boost::random::rand48::BOOST_RANDOM_DETAIL_SEED_SEQ_SEED ( rand48  ,
SeedSeq  ,
seq   
)
inline

Seeds the generator with values produced by seq.generate().

boost::random::rand48::BOOST_STATIC_CONSTANT ( bool  ,
has_fixed_range  = false 
)
void boost::random::rand48::discard ( boost::uintmax_t  z)
inline

Advances the state of the generator by z.

template<class Iter >
void boost::random::rand48::generate ( Iter  first,
Iter  last 
)
inline

Fills a range with random values.

References boost::xpressive::first, and boost::last.

uint32_t boost::random::rand48::operator() ( )
inline

Returns the next value of the generator.

void boost::random::rand48::seed ( )
inline

Seeds the generator with the default seed.

References seed().

Referenced by BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(), BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(), and seed().

template<class It >
void boost::random::rand48::seed ( It &  first,
It  last 
)
inline

Seeds the generator using values from an iterator range, and updates first to point one past the last value consumed.

Friends And Related Function Documentation

bool operator!= ( const rand48 x,
const rand48 y 
)
friend

Returns true if the two generators will produce different sequences of values.

template<class CharT , class Traits >
std::basic_ostream<CharT,Traits>& operator<< ( std::basic_ostream< CharT, Traits > &  os,
const rand48 r 
)
friend

Writes a rand48 to a std::ostream.

bool operator== ( const rand48 x,
const rand48 y 
)
friend

Returns true if the two generators will produce identical sequences of values.

template<class CharT , class Traits >
std::basic_istream<CharT,Traits>& operator>> ( std::basic_istream< CharT, Traits > &  is,
rand48 r 
)
friend

Reads a rand48 from a std::istream.


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