s=20000;sigma=34.22;m=400.3;f=5.11;p=m*f/(sigma*(f-1));k=0;n=0;
ti=clock;
pack
  u=rand(1,s);
   x=randn(1,s);
pack
for i=1:s,
   v(i)=x(i)/(2*p);
   z(i)=x(i)*(v(i)+sqrt(v(i)^2+1));
   g(i)=1/(2+z(i)/p);
	if g(i)<u(i),
	  n=n+1;
	else
	  k=k+1;
	  w(k)=sigma*z(i)+m;
	end

end

p=size(w)
a1=k
w1=w(1,1:a1);
mfz=mean(w1)
devs=std(w1)
reject=n
accept=k
duratas=etime(clock,ti)
[l,t]=hist(w,25);plot(t,l);grid
durata=etime(clock,ti)