rand command give different answer

1 次查看(过去 30 天)
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
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
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.

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by