function x=lcg(x0,a,c,m,n) y=x0; x=x0; for i=1:n y=rem(a*y+c,m); x=[x y]; end %plot(x(1:n),x(2:n+1),'*')