MATLAB: Is it possible to get the actual random seed

getrandrandomrngseed

Is it possible to get the number x, for which rng(x) has no effect on random generation?

Best Answer

s = rng;
will retrieve and store the current state of the random number generator, according to this documentation page.
Then,
rng(s)
will restore it to that state.