function count = rollDie(rolls)
% Simulate rolling of fair 6-sided die
% Usage:  count = rollDice(rolls)
%   ROLLS is the number of times to roll 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 outcomes of rolling a FAIR die
for k= 1:rolls
    face= ceil(rand(1,1)*FACES);
    count(face)= count(face) + 1;
end

% Show histogram of outcome
bar(1:FACES, count);
title(['Outcomes from ' num2str(rolls) ' rolls of fair die']);
xlabel('Outcome');  ylabel('Count');
