Main Archive Specials Wiki | FAQ Links Submit Forum

Gaussian White Noise

References : Posted by remage[AT]

Notes :

Steven W. Smith:
The Scientist and Engineer's Guide to Digital Signal Processing

Code :
#define PI 3.1415926536f

float R1 = (float) rand() / (float) RAND_MAX;
float R2 = (float) rand() / (float) RAND_MAX;

float X = (float) sqrt( -2.0f * log( R1 )) * cos( 2.0f * PI * R2 );


Added on : 27/08/02 by pan[at]spinningkids[ DOT ]org
Comment :
The previous one seems better for me, since it requires only a rand, half log and half sqrt per sample.
Actually, I used that one, but I can't remember where I found it, too. Maybe on Knuth's book.

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!


Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion