# Arbitrary noise generation

lets say I have some noise time series and I want to sample random numbers from the same underlying distribution as this time series. An easy algorithm I have found online is basically you take the noise time series, fourier transform it, randomize the phase (by multiplying by uniform phase variation), then inverse fourier transform. Unfortunately I can't seem to find where I found this algorithm, and I don't really understand why it would work. I would think that by randomizing the phase you could distort important features of the noise time-series, such as the position of potential maxima or minima (i.e., you might be more sensitive over a certain period than another period). Any help rectifying this confusion would be greatly appreciated.

It might have something to do with the following:

Let $x$ be your (finite) signal, and let $X$ be its Fourier transform (FT). Then the magnitude, $|X|^2=XX^*$ is transformed back to a convolution between $x(t)$ and $x(-t)$ due to the complex conjugate. i.e., $\mathcal{F}^{-1}(XX^*)=x*x(-\cdot)(t)$. The latter is the empirical autocorrelation of the signal. So it appears you can FT a signal, and as long as you have this magnitude, you will have the desired autocorrelation, which is an estimator for the true autocorrelation of your desired signal.

However, this works when you have a wide-sense stationary time signal, and if it is determined by second order moments.