hi, is there way to chose one no. from two numbers randomly for ex. 2,3 i.e each time chose 2 or 3 randomly

 採用された回答

Sean de Wolski
Sean de Wolski 2012 年 1 月 23 日

2 投票

round(rand+2);

その他の回答 (1 件)

Andrew Newell
Andrew Newell 2012 年 1 月 23 日

2 投票

randint + 2;
or
randint(m,n) + 2;
for a matrix of random numbers.
or
R = a + randint(m,n)*(b-a);
to choose between any two integers a and b.

カテゴリ

ヘルプ センター および 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