clear;
esp=0;
Esp2=0;
var=0;
sig=sqrt(3);
mu=5;
n=10000;
pn=100;

Ubtemp=0;



for i = 1:n;
    Ubtemp=0;
for j = 1:pn,
    u=rand(j);
    Ubtemp=Ubtemp+u;
end;
Ubar = Ubtemp/pn;
Y = sqrt(12*pn)*(Ubar-0.5);
X = Y*sig+mu;
    
    esp = esp + (X/n);
    Esp2 = (X^2)/n + Esp2;
end;
var = Esp2 - esp^2;

disp(esp); //=0
disp(var); //=1
