Easy noise generation

Type : White Noise
References : Posted by mail[AT]ihsan-dsp[DOT]com
Notes :
Easy noise generation,
in .hpp,
b_noise = 19.1919191919191919191919191919191919191919;

alternatively, the number 19 below can be replaced with a number of your choice, to get that particular flavour of noise.

Regards,
Ove Karlsen.

Code :
    b_noise = b_noise * b_noise;
    int i_noise = b_noise;
    b_noise = b_noise - i_noise;

    double b_noiseout;
    b_noiseout = b_noise - 0.5;

    b_noise = b_noise + 19;

Comments
from : arifovekarlsen[AT]hotmail[DOT]com
comment : The line is written like that, so you can change 0.5, to for instance 0.19.

from : nobody[AT]nowhere[DOT]com
comment : >>The line is written like that, so you can change 0.5, to for instance 0.19. OK. Why would I do that? What's that number control?

from : arifovekarlsen[AT]hotmail[DOT]com
comment : It controls the patterning. I usually write my algorithms tweakable. You could try even lower aswell, maybe 1e-19.

from : arifovekarlsen[AT]hotmail[DOT]com
comment : Alternatively you can do: double b_noiselast = b_noise; b_noise = b_noise + 19; b_noise = b_noise * b_noise; b_noise = b_noise + ((-b_noise + b_noiselast) * 0.5); int i_noise = b_noise; b_noise = b_noise - i_noise; This will remove the patterning.

from : nobody[AT]nowhere[DOT]com
comment : >>b_noise = b_noise + ((-b_noise + b_noiselast) * 0.5); That seems to reduce to just: b_noise=(b_noise+b_noiselast) * 0.5;

from : mymail[AT]com
comment : Hi, is this integer? Please do not disturb the forum, rather send me an email. B.i.T

from : zyxoas[AT]gmail[DOT]com
comment : This is quite a good PRNG! The numbers it generates exhibit a slight a pattern (obviously, since it's not very sophisticated) but they seem quite usable! The real FFT spectrum is very flat and "white" with just one or two aberrant spikes while the imaginary spectrum is almost perfect (as is the case with most PRNGs). Very nice! Either that or I need more practice with MuPad...