How to generate white noise?

I need some white noise, which I then can shape to have the required spectrum using filters. But how to I generate white noise?

I could do it using rand or randn:


I get

using Statistics
julia> var(noise1)

julia> var(noise2)

If I would multiply noise1 with a factor, would the spectrum be the same as the spectrum of noise2?

1 Like

Yes, the same spectrum (mean spectral density) and even the same distribution in the Fourier domain in the limit as your signal length goes to infinity, by the central limit theorem (which just requires you to make the mean and variance the same — use (rand() - 0.5) * √12 to get a variance of 1).