From 015d33adca87d305784402ce89b0b75821878a5b Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 27 Sep 2023 13:51:05 +0100 Subject: [PATCH] reword comments --- squiggle.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/squiggle.c b/squiggle.c index 02c9e3c..b332b41 100644 --- a/squiggle.c +++ b/squiggle.c @@ -22,13 +22,10 @@ // Pseudo Random number generator uint64_t xorshift32(uint32_t* seed) { - // The reader isn't expected to understand this code immediately; - // read the linked Wikipedia page! // Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" // See // https://en.wikipedia.org/wiki/Xorshift // Also some drama: , - // for floats uint64_t x = *seed; x ^= x << 13; x ^= x >> 17; @@ -38,7 +35,7 @@ uint64_t xorshift32(uint32_t* seed) uint64_t xorshift64(uint64_t* seed) { - // same as above, but for generating doubles + // same as above, but for generating doubles instead of floats uint64_t x = *seed; x ^= x << 13; x ^= x >> 7; @@ -79,7 +76,7 @@ double sample_lognormal(double logmean, double logstd, uint64_t* seed) return exp(sample_normal(logmean, logstd, seed)); } -inline double sample_normal_from_95_confidence_interval(double low, double high, uint64_t* seed) +inline double sample_normal_from_90_confidence_interval(double low, double high, uint64_t* seed) { // Explanation of key idea: // 1. We know that the 90% confidence interval of the unit normal is @@ -112,7 +109,7 @@ double sample_to(double low, double high, uint64_t* seed) // Then see code for sample_normal_from_95_confidence_interval double loglow = logf(low); double loghigh = logf(high); - return exp(sample_normal_from_95_confidence_interval(loglow, loghigh, seed)); + return exp(sample_normal_from_90_confidence_interval(loglow, loghigh, seed)); } double sample_gamma(double alpha, uint64_t* seed)