How to pick random number?
17 ビュー (過去 30 日間)
古いコメントを表示
Hi, Please forgive me if I am asking a basic question. I want to pick random number from the set {2,3}. It should either pick 2 or 3 randomly. I have been looking at these functions called 'rand', 'randi', 'randperm' etc., but i couldn't figure out how to use them for my problem. Any help would be appreciated.
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 10 月 2 日
編集済み: Azzi Abdelmalek
2013 年 10 月 2 日
randi([2 3])
%or
v=[2 3];
v(randi(2))
3 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!