% cs3113f08HW01P04.m
% K. Ming Leung, September 21, 2008
% 10 points total.

lower = 3; upper = 7; half = 0.5;
lower1 = lower - half;
upper1 = upper + half;
numberPts = (upper-lower+1)*1000;

% 9 pts on the correctness of this formula using round:
RandInts = round(lower1+rand(1,numberPts)*(upper1-lower1));
% Same result if the following is used:
RandInts = round(lower-0.5+rand(1,numberPts)*(upper-lower+1));

Distribution = hist(RandInts,lower:upper)
hist(RandInts,lower:upper)
xlabel('Numbers Generated');
ylabel('Frequency Count');
title('Using rounding');
