s=200000;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
v=x./(2*p);q=ones(1,s);
z=x.*(v+(v.^2+q).^.5);
g=p./(2*p+z);
b=g-u;
i=find(sign(b)>=0);
w=[z(i)];
w1=sigma*w+m;

h=length(w)
a1=h
%w1=w(1,1:a1);
mfz=mean(w1)
devs=std(w1)
reject=s-h
accept=h
duratas=etime(clock,ti)
whitebg
[l,t]=hist(w1,25);plot(t,l,'r');grid
title(' WMC-distributia var. aleatoare [Ascheid (1990), Duma(1997)]') 
durata=etime(clock,ti)