how to get randomization seed ?
2 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Peter Perkins
on 2 Dec 2014
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.
0 Comments
More Answers (1)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!