From 75abeca4a9d606bee89a41475f2f451187fec127 Mon Sep 17 00:00:00 2001
From: 3gg <3gg@shellblade.net>
Date: Sat, 4 Feb 2023 18:17:39 -0800
Subject: More compliance with C11.

---
 random/src/normal.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'random/src')

diff --git a/random/src/normal.c b/random/src/normal.c
index d4bcac1..5978274 100644
--- a/random/src/normal.c
+++ b/random/src/normal.c
@@ -2,16 +2,18 @@
 
 #include <math.h>
 
+#define PI 3.14159265359
+
 // Generate two samples in the standard normal distribution using the
 // Box-Muller transform.
 // https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
 void normal2(double u, double v, double* z0, double* z1) {
   const double r = sqrt(-2 * log(u));
-  const double x = 2 * M_PI * v;
-  *z0 = r * cos(x);
-  *z1 = r * sin(x);
+  const double x = 2 * PI * v;
+  *z0            = r * cos(x);
+  *z1            = r * sin(x);
 }
 
 double normal_transform(double z, double mu, double sigma) {
-  return z*sigma + mu;
+  return z * sigma + mu;
 }
-- 
cgit v1.2.3