필터 지우기
필터 지우기

rand command give different answer

조회 수: 1 (최근 30일)
Abdullah Haris
Abdullah Haris 2020년 2월 9일
댓글: Iqra 2023년 1월 6일
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