How to set randomization numbers ?

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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2020 年 11 月 19 日

コメント済み:

2020 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by