フィルターのクリア

Can't understand what rng(seed) does.

25 ビュー (過去 30 日間)
DM
DM 2015 年 4 月 20 日
コメント済み: the cyclist 2015 年 4 月 20 日
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.

回答 (1 件)

the cyclist
the cyclist 2015 年 4 月 20 日
編集済み: the cyclist 2015 年 4 月 20 日
The Random seed Wikipedia page might help you understand.
This page from stackoverflow may also help.
  2 件のコメント
DM
DM 2015 年 4 月 20 日
Mu understanding after reading the page from stackoverflow is that you pick a seed and when you use it in rng, your will get the same sequence of numbers once you use rand, randi?
the cyclist
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 ExchangeRandom Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by