Easy noise generation

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
1
2
3
4
5
6
7
8
    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

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...
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.
>>b_noise = b_noise + ((-b_noise + b_noiselast) * 0.5);

That seems to reduce to just:

b_noise=(b_noise+b_noiselast) * 0.5;
Hi, is this integer? Please do not disturb the forum, rather send me an email.

B.i.T
The line is written like that, so you can change 0.5, to for instance 0.19.
>>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?
It controls the patterning. I usually write my algorithms tweakable.

You could try even lower aswell, maybe 1e-19.