Fix the random values

6 ビュー (過去 30 日間)
Manu Chaudhary
Manu Chaudhary 2022 年 9 月 24 日
コメント済み: Star Strider 2022 年 9 月 24 日
Hi everyone, I have this below code of matlab, which generates random values.
data_size = 8; % not necessarily a power-of-2
data_range = [0 255];
data = randi(data_range, data_size, 1) + 1i*randi(data_range, data_size, 1); % Complex Data
I am new at matlab. Is there a way to fix these random values. I need it because i am stuck with some debugging.

採用された回答

Star Strider
Star Strider 2022 年 9 月 24 日
The rng function controls the seed.
Example —
rng(1)
r1 = randi(9,1,10)
r1 = 1×10
4 7 1 3 2 1 2 4 4 5
rng(1)
r2 = randi(9,1,10)
r2 = 1×10
4 7 1 3 2 1 2 4 4 5
There are a number of helpful links in the See Also section of the documentation that explain it.
.
  7 件のコメント
Manu Chaudhary
Manu Chaudhary 2022 年 9 月 24 日
Thank you. Great help.
Star Strider
Star Strider 2022 年 9 月 24 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by