Average of 2 sets of random numbers

조회 수: 3 (최근 30일)
Aren Arslanyan
Aren Arslanyan 2020년 9월 20일
댓글: Adam Danz 2020년 9월 20일
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

답변 (1개)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 9월 20일
Take a look at the binomial generator, it does what you want to.
  댓글 수: 1
Adam Danz
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 CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by