Boost logo

Boost Users :

Subject: [Boost-users] [random] saving state of generator
From: Thomas Mang (thomasmang.ng_at_[hidden])
Date: 2012-01-31 02:20:47


Consider an application intended to run for weeks and where a
deterministic sequence of random numbers is needed (deterministic in
order to make results 100% reproduceable).
For hardware-related reasons that application might get halted (killed).
In order to smoothly restart the application I would like to regularly
save the complete system state and can hence use that as restore point.
That complete save works for everything except the random number
generator - I am using boost::random::mt19937.
The mt199937 class does not seem to offer such an option (full state
save). Using serialization also does not sound great in my eyes as I am,
of course, not familiar with the internal representation of mt19937.
So what is the best option? Dissecting mt19937 (intrusive changes to
class template mersenne_twister_engine) and making my own serialization
routine? Any other / more straightforward ideas?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at