What I want to do is that using the sequential state to generate random numbers when given a fix seed and a generator method.e.g. given rng(1),generating some random number and then record the current state which will be used as the initial state of next step (continue generating random numbers in the next loop).
for i=1:10
if i==1
rng(1);
else
load the state
use the state as the initial state
end
a=rand;
b=rand;...
save the current state
end
At the end I need this state sequence to repeat my simulations and also ensure I can control the rand numbers of every step within the loop.