%drawing n numbers in the interval [a,b] according
%to the uniform distribution
n=10000;
a=1; b=3;
%drawing n numbers in interval [a,b], the result
%is collecting in the vector x

x=random("unif",a,b,1,n);

k=0;
c=1.5; d=2.5;
%determing the number of x in the interval [c,d]
for i=1:n
  if (x(i)>c) &&(x(i)<=d)
    k=k+1;
  endif
end

%experimental proportion
wyn=k*1./n;
%theoretical result
orig=(d-c)/(b-a);
%the comparison of results

printf("k = %d, wyn = %f, orig = %f \n",k,wyn,orig);

