diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
commit | 24c8bcfe7f76b20124e2862ea050f815c0f768e7 (patch) | |
tree | e5bdbd638a2c7f38f1c094cc9e95cbdfe05b9481 /src/random.c | |
parent | 0b7f199c0d93074484ea580504485a32dc29f5e2 (diff) | |
download | sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.gz sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.bz2 sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.zip |
move everything to src directory
Diffstat (limited to 'src/random.c')
-rw-r--r-- | src/random.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/random.c b/src/random.c new file mode 100644 index 0000000..f6cf85e --- /dev/null +++ b/src/random.c @@ -0,0 +1,14 @@ +#include "random.h" +#include <math.h> + +double randn(void) +{ + /* Generates a random number from a normal distribution using the + * Box-Muller transform. */ + double u1, u2; + + u1 = genrand_real1(); + u2 = genrand_real1(); + + return sqrt(-2*log(u1))*cos(2*M_PI*u2); +} |