function rollDie(n)
% Simulate rolling of a fair 6-sided die n times

FACES= 6;               % number of faces on die
count= zeros(1,FACES);  % bins to store counts
                        % count(f) is the number of occurences of face f

% Count outcomes of rolling a FAIR die
face= ceil(rand(1,n).*FACES);
for k= 1:n
    count(face(k))= count(face(k)) + 1;
end

% Show histogram of outcome
bar(1:FACES, count);
title(sprintf('%d rolls of a fair die', n))
xlabel('Outcome');  ylabel('Count');
