MATLAB: How to get randomization seed

random number generator

how to get the randomization seed of an execution without using rng ?
When we use 's=rng;' the seed is set to 0. I want to get seed of execution, so that I can repeat the execution instance which I find as working well.

Best Answer

Joe, I think you want the random number state, not the seed. RNG will give you both.
You description is a little vague, but I think what you mean is this:
You run some code that involves random numbers. If something interesting happens, you want to be able to rerun it using the same random numbers.
If you save the output of RNG before running the code, then restore the state again using RNG, your code will use the same random numbers again. The first example on the RNG reference page shows how to do this.