**References :** Posted by remage[AT]netposta.hu

**Notes :**

SOURCE:

Steven W. Smith:

The Scientist and Engineer's Guide to Digital Signal Processing

http://www.dspguide.com

**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 );

**Comments**

__from__ : 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.