function count = rollDie(n)
% Simulate rolling of a fair 6-sided die
% Usage:  count = rollDieV1(rolls)
%   ROLLS is the number of times to roll the die
%   COUNT is vector of how many times each outcome occurs
%     count(f) is the number of times face f occurs

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
for k = 1:n
    face= floor(rand()*FACES) + 1;
    count(face)= count(face) + 1;
end

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