
Neal D. Becker wrote:
In order to serialize, it would be helpful to add an interface to mersenne_twister to get/set the state. I don't think there is any I/F to get the state.
Possible patch: Index: mersenne_twister.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/mersenne_twister.hpp,v retrieving revision 1.16 diff -c -r1.16 mersenne_twister.hpp *** mersenne_twister.hpp 27 Jul 2004 03:43:32 -0000 1.16 --- mersenne_twister.hpp 1 Sep 2004 20:05:31 -0000 *************** *** 171,176 **** --- 171,183 ---- { return !(*this == rhs); } #endif + template<typename cont_t> + void getstate (cont_t& c) const { + if (c.size() < stat_size) + throw std::invalid_argument("mersenne_twister::getstate"); + std::copy (&x[0], &x[state_size], c.begin()); + } + private: // returns x(i-n+index), where index is in 0..n-1 UIntType compute(unsigned int index) const