function counts = rollDie(rolls)
% Simulate rolling of a 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
counts= zeros(1,FACES); % bins to store counts

% Count outcomes of rolling a FAIR die
for k = 1:rolls
% roll the die
face= ceil(rand()*FACES);
% increment appropriate bin
counts(face)= counts(face) + 1;
end

% Show histogram of outcome
bar(1:length(counts), counts)
title(sprintf('Outcomes from %d rolls of a fair die', rolls), 'Fontsize',14)
xlabel('Outcome', 'Fontsize',14)
ylabel('Count', 'Fontsize',14)
shg