From d531d5571ff74b9ee8c7073c82c1b49ac6b4e359 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 23 Jul 2023 16:30:42 +0200 Subject: [PATCH] formatting pass. --- squiggle.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/squiggle.c b/squiggle.c index b148092..96288d6 100644 --- a/squiggle.c +++ b/squiggle.c @@ -35,11 +35,11 @@ uint64_t xorshift64(uint64_t* seed) // https://en.wikipedia.org/wiki/Xorshift // Also some drama: , - uint64_t x = *seed; - x ^= x << 13; - x ^= x >> 7; - x ^= x << 17; - return *seed = x; + uint64_t x = *seed; + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + return *seed = x; } // Distribution & sampling functions @@ -70,9 +70,9 @@ double sample_normal(double mean, double sigma, uint64_t* seed) return (mean + sigma * sample_unit_normal(seed)); } -double sample_lognormal(double logmean, double logsigma, uint64_t* seed) +double sample_lognormal(double logmean, double logstd, uint64_t* seed) { - return expf(sample_normal(logmean, logsigma, seed)); + return exp(sample_normal(logmean, logstd, seed)); } double sample_to(double low, double high, uint64_t* seed) @@ -84,8 +84,8 @@ double sample_to(double low, double high, uint64_t* seed) double loglow = logf(low); double loghigh = logf(high); double logmean = (loglow + loghigh) / 2; - double logsigma = (loghigh - loglow) / (2.0 * NORMAL95CONFIDENCE); - return sample_lognormal(logmean, logsigma, seed); + double logstd = (loghigh - loglow) / (2.0 * NORMAL95CONFIDENCE); + return sample_lognormal(logmean, logstd, seed); } double sample_gamma(double alpha, uint64_t* seed) @@ -105,7 +105,7 @@ double sample_gamma(double alpha, uint64_t* seed) v = 1.0 + c * x; } while (v <= 0.0); - v = v * v * v; + v = v * v * v; u = sample_unit_uniform(seed); if (u < 1.0 - 0.0331 * (x * x * x * x)) { // Condition 1 // the 0.0331 doesn't inspire much confidence