how can i generate a random number between two float numbers

75 ビュー (過去 30 日間)
user06
user06 2018 年 9 月 12 日
回答済み: James Tursa 2018 年 9 月 12 日
I am trying to generate a random number between two float numbers by using
val = randi([mnval mxval],1,1)
where mxval and mnval are two float numbers. when i run the above command "First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX." error is coming.

採用された回答

James Tursa
James Tursa 2018 年 9 月 12 日
This is one of the examples in the rand doc:
val = mnval + rand*(mxval-mnval);

その他の回答 (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