N=100000; % number of samples
I = 0;  % integral
for i=1:N
    r= rand; % uniform [0,1] random variable
    I=I+r*r/N;
end
I
