N=[100, 10000, 1000000];
for i=1:3
    r=rand(1,N(i));
    a(1)=sum(r<(1/6));
    for k=2:6
        a(k)=sum(  ( r>((k-1)/6) ) .* (r<(k/6)) );
    end
    subplot(1,3,i);
    stem(a/N(i)); 
    text(1,0.27,sprintf('%d rzutów',N(i)));
    set(gca, 'xlim', [0 7], 'xtick', [1:6], 'ylim', [0 .25]);
    set(gca,'ytick', 0.1:0.1:0.2, 'fontsize', 14)
    clear a r
end
