%Peng 5.9 This functions returns a number between 1 and 6
function interval = dice()
clear all; clc;
tal = rand(1,1);
fprintf('the simulated throw gives back the following value %f\n', tal);

n = 0:6;
l = (1/6)*ones(size(n));
disp('the interval limits are:');
limit = n.*l;

disp('the boolean vector is:');
boolean_under = (tal>=limit);

interval_temp = 0;
k=1;
while k>0
    k = boolean_under(interval_temp+1);
    interval_temp = interval_temp+1;
end
interval= interval_temp-1;
