How to set randomization numbers ?

조회 수: 2 (최근 30일)
Ali Najem
Ali Najem 2020년 11월 19일
댓글: Ali Najem 2020년 11월 19일
Hi everyone.
I need to set my randmization number for instance:
A=randn(1,2);
B=randn(1,3);
I want this thing, when I run many times I would get the same random numbers kindly, any help will be appreciated..

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 19일
You can give a constant seed at beginning of your code
rng(0); % replace 0 with anything
A=randn(1,2);
B=randn(1,3);
  댓글 수: 1
Ali Najem
Ali Najem 2020년 11월 19일
Thank u so much sir for your answer

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by