%die
M=10000; %M is number of different simulations
N=10000; %N is number of "experiments"
psixs =[];
for i = 1:M
nsix=0;
for j= 1:N
nsix = nsix + (rand<1/6);
end
psix = nsix/N;
psixs = [psixs psix]; %collect all approximate probabilities
end
hist(psixs, 20)
hold on
plot([1/6 1/6],[0 2000],'r-', 'linewidth',4)
hold off
mean(psixs)