What is the difference between rand and randi when using it in a 3D array

8 ビュー (過去 30 日間)
Shivam
Shivam 2018 年 8 月 25 日
コメント済み: Foad Brakhasi 2023 年 1 月 18 日
What is the difference between rand and randi when using it in a 3D array

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 25 日
編集済み: KALYAN ACHARJYA 2018 年 8 月 25 日
Its similar as usual, rand for uniformly distributed random number including floatings numbers, whereas randi for integers.

その他の回答 (1 件)

madhan ravi
madhan ravi 2018 年 8 月 25 日
Maybe try this:
array(randi([1 length(array)],1))
  8 件のコメント
madhan ravi
madhan ravi 2018 年 8 月 25 日
Give a vote for my answer if you find it useful :)
Foad Brakhasi
Foad Brakhasi 2023 年 1 月 18 日
Thanks it was useful.

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by