Home | Libraries | People | FAQ | More |
boost::random::mixmax_engine
// In header: <boost/random/mixmax.hpp> template<int Ndim, unsigned int SPECIALMUL, boost::int64_t SPECIAL> class mixmax_engine { public: // types typedef boost::uint64_t result_type; // member classes/structs/unions struct rng_state_st { // public data members boost::array< boost::uint64_t, Ndim > V; boost::uint64_t sumtot; int counter; }; // construct/copy/destruct explicit mixmax_engine(); explicit mixmax_engine(boost::uint64_t); explicit mixmax_engine(uint32_t, uint32_t, uint32_t, uint32_t); template<typename It> mixmax_engine(It &, It); template<typename SeedSeq> explicit mixmax_engine(SeedSeq &); // public member functions BOOST_STATIC_CONSTEXPR result_type min(); BOOST_STATIC_CONSTEXPR result_type max(); void seed(boost::uint64_t = default_seed); template<typename It> void seed(It &, It); template<typename SeeqSeq> void seed(SeeqSeq &); boost::uint64_t operator()(); template<typename Iter> void generate(Iter, Iter); void discard(boost::uint64_t); // friend functions template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const mixmax_engine &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, mixmax_engine &); // private member functions boost::uint64_t MOD_MERSENNE(boost::uint64_t); boost::uint64_t MULWU(boost::uint64_t); void seed_vielbein(rng_state_t *, unsigned int); void seed_uniquestream(rng_state_t *, uint32_t, uint32_t, uint32_t, uint32_t); boost::uint64_t iterate_raw_vec(boost::uint64_t *, boost::uint64_t); boost::uint64_t apply_bigskip(boost::uint64_t *, boost::uint64_t *, uint32_t, uint32_t, uint32_t, uint32_t); boost::uint64_t modadd(boost::uint64_t, boost::uint64_t); boost::uint64_t fmodmulM61(boost::uint64_t, boost::uint64_t, boost::uint64_t); // public data members static const boost::uint64_t mixmax_min; static const boost::uint64_t mixmax_max; static const bool has_fixed_range; static const int N; // The main internal parameter, size of the defining MIXMAX matrix. };
Instantiations of class template mixmax_engine model, pseudo-random number generator . It uses the MIXMAX generator algorithms from:
G.K.Savvidy and N.G.Ter-Arutyunian, On the Monte Carlo simulation of physical systems, J.Comput.Phys. 97, 566 (1991); Preprint EPI-865-16-86, Yerevan, Jan. 1986 http://dx.doi.org/10.1016/0021-9991(91)90015-D
K.Savvidy The MIXMAX random number generator Comp. Phys. Commun. 196 (2015), pp 161–165 http://dx.doi.org/10.1016/j.cpc.2015.06.003
K.Savvidy and G.Savvidy Spectrum and Entropy of C-systems. MIXMAX random number generator Chaos, Solitons & Fractals, Volume 91, (2016) pp. 33–38 http://dx.doi.org/10.1016/j.chaos.2016.05.003
The generator crucially depends on the choice of the parameters. The valid sets of parameters are from the published papers above.
mixmax_engine
public
construct/copy/destructexplicit mixmax_engine();Constructor, unit vector as initial state, acted on by A^2^512.
explicit mixmax_engine(boost::uint64_t);Constructor, one 64-bit seed.
< constructor, one uint64_t seed, random numbers are statistically independent from any two distinct seeds, e.g. consecutive seeds are ok
explicit mixmax_engine(uint32_t clusterID, uint32_t machineID, uint32_t runID, uint32_t streamID);Constructor, four 32-bit seeds for 128-bit seeding flexibility.
template<typename It> mixmax_engine(It & first, It last);
template<typename SeedSeq> explicit mixmax_engine(SeedSeq & seq);
mixmax_engine
public member functionsBOOST_STATIC_CONSTEXPR result_type min();
BOOST_STATIC_CONSTEXPR result_type max();
void seed(boost::uint64_t seedval = default_seed);seed with one 64-bit seed
template<typename It> void seed(It & first, It last);
Sets the state of the generator using values from an iterator range.
template<typename SeeqSeq> void seed(SeeqSeq & seq);
Sets the state of the generator using values from a seed_seq
.
boost::uint64_t operator()();
return one uint64 between min=0 and max=2^61-1
template<typename Iter> void generate(Iter first, Iter last);
Fills a range with random values
void discard(boost::uint64_t nsteps);discard n steps, required in boost::random
mixmax_engine
friend functionstemplate<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & ost, const mixmax_engine & me);
save the state of the RNG to a stream
template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & in, mixmax_engine & me);
read the state of the RNG from a stream
mixmax_engine
private member functionsboost::uint64_t MOD_MERSENNE(boost::uint64_t k);
boost::uint64_t MULWU(boost::uint64_t k);
void seed_vielbein(rng_state_t * X, unsigned int i);
void seed_uniquestream(rng_state_t * Xin, uint32_t clusterID, uint32_t machineID, uint32_t runID, uint32_t streamID);
boost::uint64_t iterate_raw_vec(boost::uint64_t * Y, boost::uint64_t sumtotOld);
boost::uint64_t apply_bigskip(boost::uint64_t * Vout, boost::uint64_t * Vin, uint32_t clusterID, uint32_t machineID, uint32_t runID, uint32_t streamID);
boost::uint64_t modadd(boost::uint64_t foo, boost::uint64_t bar);
boost::uint64_t fmodmulM61(boost::uint64_t cum, boost::uint64_t s, boost::uint64_t a);