Can't understand what rng(seed) does.
15 次查看(过去 30 天)
显示 更早的评论
I have come across this command in matlab. rng(seed). I used the help to understand what its means, and I still don't get it. Can anyone help me understand what it does?
rng Control the random number generator used by RAND, RANDI, and RANDN.
rng(SD) seeds the random number generator using the non-negative
integer SD so that RAND, RANDI, and RANDN produce a predictable
sequence of numbers.
THanks.
0 个评论
回答(1 个)
the cyclist
2015-4-20
编辑:the cyclist
2015-4-20
This page from stackoverflow may also help.
2 个评论
the cyclist
2015-4-20
Yes. You can think of the pseudorandom numbers from the generator as a long -- very long -- list of numbers that are uncorrelated with each other, and the seed determines where in that list you start.
另请参阅
类别
在 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!