Changing the matlab seed
15 次查看(过去 30 天)
显示 更早的评论
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?
回答(2 个)
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!