rename sample_normal_from_90_ci and add to squiggle.h

master
NunoSempere 5 months ago
parent 95cedff3ab
commit c3de336a5b

@ -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)

@ -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);

Loading…
Cancel
Save