![]() |
Home | Libraries | License | Support | People | ALPS Web Site |
alps::pseudo_des — A random number generator using the pseudo-DES algorithm.
// In header: <alps/random/pseudo_des.h> class pseudo_des { public: // types typedef uint32_t result_type; // type of the random numbers // construct/copy/destruct pseudo_des(); explicit pseudo_des(uint32_t); // public member functions BOOST_STATIC_CONSTANT(uint32_t, default_seed = 4357); result_type min BOOST_PREVENT_MACRO_SUBSTITUTION() const; result_type max BOOST_PREVENT_MACRO_SUBSTITUTION() const; void seed(uint32_t = default_seed); result_type operator()(); void operator+=(uint32_t); std::ostream & write(std::ostream &) const; std::istream & read(std::istream &); bool operator==(const pseudo_des &) const; // public static functions static uint32_t hash(uint32_t, uint32_t); // protected static functions static uint32_t low_bits(uint32_t); static uint32_t high_bits(uint32_t); static uint32_t swap_bits(uint32_t); // public data members static const bool has_fixed_range; // the range is fixed static const result_type min_value; // minimum value is 0 static const result_type max_value; // maximum value is 2^32-1 };
The random number generator follows the BOOST (standard C++) specifications
pseudo_des
public member functionsBOOST_STATIC_CONSTANT(uint32_t, default_seed = 4357);the default seed is 4357
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION() const;minim value is 0
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION() const;maximum value is 2^32-1
void seed(uint32_t s = default_seed);seed the generator
result_type operator()();get the next value
void operator+=(uint32_t skip);skip forward by skip numbers
std::ostream & write(std::ostream & os) const;write the state to a std::ostream
std::istream & read(std::istream & is);read the state from a std::istream
bool operator==(const pseudo_des & rhs) const;check whether the initial seed and current state of two generators is the same
Copyright © 2006-2008 Brigitte Surer, Matthias Troyer |