Generating random numbers from a certain interval

Hi, I generated random numbers within the range 0.0 to 0.01 by this code x= 0.0 + (0.01-0.0).*rand() ,but some of generated random numbers x have unwanted value like "1.1902e-004". How can I solve and skip this value to obtain normal values?
Thanks in advance,

 採用された回答

Geoff Hayes
Geoff Hayes 2016 年 11 月 17 日

0 投票

area - 1.1902e-004 is an alternative format to writing 0.00011902 which is a valid number within your interval. Try calling
format long g
before running your code (to generate the random numbers) and you should see how the effect of this format.

1 件のコメント

arwa
arwa 2016 年 11 月 17 日
well, i've tried. it's done
Many thanks for you...

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2016 年 11 月 17 日

コメント済み:

2016 年 11 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by