Average of 2 sets of random numbers
2 ビュー (過去 30 日間)
古いコメントを表示
I need to create a fair sided coin, tails=-1 and heads=+1, and run a random number generator that gives the results of a 100 flips, 1000 flips
0 件のコメント
回答 (1 件)
Thiago Henrique Gomes Lobato
2020 年 9 月 20 日
1 件のコメント
Adam Danz
2020 年 9 月 20 日
+1
Another option that doesn't req. Stat & ML Toolbox:
n = 10; % Number of coin flips
f = round(rand(1,n)).*2-1;
% f =
% -1 -1 1 -1 -1 1 1 -1 1 -1
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!