rand command give different answer

mat.jpg
why this rand command give different result

1 件のコメント

Stephen23
Stephen23 2020 年 2 月 9 日
"why this rand command give different result"
What do you expect its output to be?

サインインしてコメントする。

回答 (2 件)

James Tursa
James Tursa 2020 年 2 月 9 日
編集済み: James Tursa 2020 年 2 月 9 日

1 投票

rand( ) is a random number generator ... it is supposed to give a different result.
doc rand
If you want to start over with the same stream of numbers you will need to re-seed it.

1 件のコメント

Iqra
Iqra 2023 年 1 月 6 日
beacuse rand function generates value randamly between 0 and 1 interval

サインインしてコメントする。

Chuguang Pan
Chuguang Pan 2020 年 2 月 9 日

0 投票

All the random number functions, rand, randn, randi, and randperm, draw values from a shared random number generator. Every time you start MATLAB, the generator resets itself to the same state.
The rand function draw values from a RandStream.

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2019a

タグ

質問済み:

2020 年 2 月 9 日

コメント済み:

2023 年 1 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by