Changing the matlab seed

조회 수: 17 (최근 30일)
Arvind Ganesh
Arvind Ganesh 2018년 9월 21일
댓글: Arvind Ganesh 2018년 9월 21일
The seed is not changing when I close the Matlab and open a new one. The seed is always being set as 0. How can I fix this?
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 21일
Detail, please?

댓글을 달려면 로그인하십시오.

답변 (2개)

Bjorn Gustavsson
Bjorn Gustavsson 2018년 9월 21일
Your question is a bit on the vague end - but I'll guess that you're asking about the seed for the random number generator...
If that's the case you should take a look at the help for rand, or look for the documentation pages "Updating Your Random Number Generator Syntax". From the former there is a link towards the latter, the latter describes in detail how to randomize the start of the random number sequence...
HTH
  댓글 수: 4
Stephen23
Stephen23 2018년 9월 21일
편집: Stephen23 2018년 9월 21일
"This is not supposed to happen. The seed should change when I close and open a new Matlab window."
Yes, it is supposed to happen. This is exactly the documented behavior. In fact this is such a common topic that there is a whole page devoted to explaining this:
That page also explains how to get different random numbers, and is easy to find using any internet search engine.
Arvind Ganesh
Arvind Ganesh 2018년 9월 21일
Thank you. That is helpful.

댓글을 달려면 로그인하십시오.


Dennis
Dennis 2018년 9월 21일
You can use
rng('shuffle')
For more information have a look here

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by