summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-10-28 13:28:18 -0400
committerpommicket <pommicket@gmail.com>2022-10-28 13:28:18 -0400
commitaf6a9c5552d3bd4e708d644cc47e4be4ca2edaf8 (patch)
tree700fa3006babc185018b9ac49cdec90dbce50cb9 /math.c
parent67beb21c710509acdb11017a77805ec57676e666 (diff)
fixed rust '\\' highlighting, among other things
Diffstat (limited to 'math.c')
-rw-r--r--math.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/math.c b/math.c
index d1f30dc..c7ac64b 100644
--- a/math.c
+++ b/math.c
@@ -176,7 +176,10 @@ static inline float randf(void) {
static float rand_gauss(void) {
// https://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution
- float U = randf(), V = randf();
+ float U, V;
+ do
+ U = randf(), V = randf();
+ while (U == 0 || V == 0);
return sqrtf(-2 * logf(U)) * cosf(TAUf * V);
}