One idiom that we are slowly moving toward is requiring that all methods (such as rand) which use random numbers should accept an RNG as an argument, so you might be able to write something like
r = MersenneTwister() stage1(r) r_a = deepcopy(r) stage2_a(r_a) r_b = deepcopy(r) stage2_b(r_b) Within each function, you need to make sure that each call to rand includes references the RNG argument. At the moment, this won't work with Distributions.jl, so you're limited to the rand methods in Base. On Monday, 23 February 2015 17:02:01 UTC, Steve Kay wrote: > > I'm trying to build a simulation model with sequential stages. I only want > to set the seed for the random number generator once at the very start of > the simulation comparing different possible strategies. Stage 1 is common > to all strategies and involves running lots of sims to reach stage 2 . At > this stage my strategies follow different routes. Ideally I'd like to store > the state of the random number generator just before starting stage 2 (and > be able to recall it at a later time). That way I can run my first strategy > through, then reset to the same state at the start of stage 2 and run the > next strategy through, etc. All strategies then facing the same random > conditions (without having to rerun stage 1 or set another seed at stage > 2).. Are there such commands that store and reset the number generator to a > particular state? Any help much appreciated. > > Best, > > Steve >
