# Average of 2 sets of random numbers

2 vues (au cours des 30 derniers jours)
Aren Arslanyan le 20 Sep 2020
Commenté : Adam Danz le 20 Sep 2020
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 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Take a look at the binomial generator, it does what you want to.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Adam Danz le 20 Sep 2020
+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

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by