Average of 2 sets of random numbers
1 次查看(过去 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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!