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.

 채택된 답변

Peter Perkins
Peter Perkins 2014년 12월 2일

1 개 추천

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.

추가 답변 (1개)

Joe
Joe 2014년 12월 2일

0 개 추천

Hi Peter,
Thanks for the reply. You got my context exactly. I thought s=rng will set the seed as 0. I didn't know that it would save the current seed. i saw that it is always returning seed as 0.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

Joe
2014년 11월 30일

답변:

Joe
2014년 12월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by