From c3de336a5b48ec471cd547a656ee43bf1f1c65d8 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Thu, 14 Dec 2023 12:37:12 +0000 Subject: [PATCH] rename sample_normal_from_90_ci and add to squiggle.h --- squiggle.c | 6 +++--- squiggle.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/squiggle.c b/squiggle.c index d20d91b..ec0d4a2 100644 --- a/squiggle.c +++ b/squiggle.c @@ -70,7 +70,7 @@ double sample_lognormal(double logmean, double logstd, uint64_t* seed) return exp(sample_normal(logmean, logstd, seed)); } -inline double sample_normal_from_90_confidence_interval(double low, double high, uint64_t* seed) +double sample_normal_from_90_ci(double low, double high, uint64_t* seed) { // Explanation of key idea: // 1. We know that the 90% confidence interval of the unit normal is @@ -101,10 +101,10 @@ double sample_to(double low, double high, uint64_t* seed) // returns a sample from a lognorma with a matching 90% c.i. // Key idea: If we want a lognormal with 90% confidence interval [a, b] // we need but get a normal with 90% confidence interval [log(a), log(b)]. - // Then see code for sample_normal_from_90_confidence_interval + // Then see code for sample_normal_from_90_ci double loglow = log(low); double loghigh = log(high); - return exp(sample_normal_from_90_confidence_interval(loglow, loghigh, seed)); + return exp(sample_normal_from_90_ci(loglow, loghigh, seed)); } double sample_gamma(double alpha, uint64_t* seed) diff --git a/squiggle.h b/squiggle.h index d0cec35..100ea68 100644 --- a/squiggle.h +++ b/squiggle.h @@ -15,6 +15,7 @@ double sample_unit_normal(uint64_t* seed); double sample_uniform(double start, double end, uint64_t* seed); double sample_normal(double mean, double sigma, uint64_t* seed); double sample_lognormal(double logmean, double logsigma, uint64_t* seed); +double sample_normal_from_90_ci(double low, double high, uint64_t* seed); double sample_to(double low, double high, uint64_t* seed); double sample_gamma(double alpha, uint64_t* seed);