%***********************************************
%  Matlab function that simulates the dice-toss 
%  experiment. Each face is assumed equally 
%  likely. 
%  
%  SYNOPSIS: 
%  [x,p_vec] = dice(N)
%  AUTHOR: Balu Santhanam
%  DATE  : 02/11/02
%************************************************
function [x,p_vec] = dice(N)
if mod(N,1) ~= 0
   error('N has to be a integer')
elseif N <= 0
   error('N has to be positive')
elseif isnumeric(N) ~= 1
   error('N has to be numeric')
end
y = 6*rand(1,N); % Produces y in [0-6]
x = floor(y) + 1;
p_vec = hist(x,6)/N;
return
%************************************************
