I am trying to write a Matlab code to simulate a dice and compute its mean and standard deviation.
The problem is that no matter how many times we run this code, the result of randi(6) keeps the same. It made me crazy.
n=20;
m=0;
c=0;
for i=1:10000
while m<n
x(i,c+1)=randi(6);
c=c+1;
m=m+x(i,c);
end
M(i)=m;
count(i)=c;
diff(i)=M(i)-n;
end
Aucun commentaire:
Enregistrer un commentaire