How can I generate a lot of (for example N=20000 or more) auto-correlated random numbers {x_n, n=1,2,...,N} with uniform or normal probability distribution and finite correlation length (Here eq. correlation length = 3), i.e. =a0*d(n-m,0)+a1*d(n-m,1)+a2*d(n-m,2)+a3*d(n-m,3) where 1>=a0>=a1>=a2>=a3>=0 will given as inputs.
I write a code according to "Method 1 of simulation", but it takes a lot of Ram and time.
Can any one write an optimized code for me about this problem in fortran, matlab or mathematica or propose a revised or new algorithm for it?