s=5000;sigma=34.22;m=400.3;f=5.11;p=(2*m*f/(sigma*(f-1)))^(-1);k=0;n=0;
for i=1:s,
   u(i)=rand(1);
   x(i)=randn(1);
  % v(i)=x(i)/(2*p);
   %z(i)=x(i)*(v(i)+sqrt(v(i)^2+1));
   g(i)=.5*(1-x(i)/sqrt((1/p)^2+x(i)^2));
	if g(i)<u(i),
	  n=n+1;
	else
	  k=k+1;
	  w(k)=sigma*x(i)*(x(i)*p+sqrt(1+(x(i)*p)^2))+m;
	end
end
reject=n
accept=k
[l,t]=hist(w,25);plot(t,l);grid