static t_int *noise_perform(t_int *w) { t_float *out = (t_float *)(w[1]); int *vp = (int *)(w[2]); int n = (int)(w[3]);
getting arguments ...
int val = *vp;
setting seed
while (n--) {
looping over the dsp block
*out++ = ((float)((val & 0x7fffffff) - 0x40000000)) * (float)(1.0 / 0x40000000);
scaling the random number between -1 and 1
val = val * 435898247 + 382842987;
generating new random number
} *vp = val;
dont forget it
return (w+4);
}
done ...
if you are interested in different noise generators most of the noise generators from supercollider (quite a log actually) are part of sc4pd ... an sc header file contains the inline functions for the rngs ...
cheers ... tim