s=15000;sigma=34.22;m=400.3;f=5.11;p=m*f/(sigma*(f-1));k=0;n=0;
  u=rand(1,s);
   x=randn(1,s);
ti=clock;
subplot(121)
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
reject=n
a=k

[l,t]=hist(w,25);plot(t,l);grid
title('WMC fara zgomot ')

%axis([250 550 0 800]);
ith=25;a1=a;
length(w)
w1=w(1,1:a1);
mfz=mean(w1)
devs=std(w1)



subplot(122)
y=ith*randn(1,a1);
b=y+w1;
mcz=mean(b)
devs1=std(b)
[l1,t1]=hist(b,25);plot(t1,l1);grid
%axis([250 550 0 800]);
title('WMC cu zgomot')
durata=etime(clock,ti)