formatting pass.

This commit is contained in:
NunoSempere 2023-07-22 19:25:36 +02:00
parent 36249ebf39
commit 57adb08057

View File

@ -31,7 +31,7 @@ uint32_t xorshift32(uint32_t* seed)
// Unit distributions // Unit distributions
float sample_unit_uniform(uint32_t* seed) float sample_unit_uniform(uint32_t* seed)
{ {
// samples uniform from [0,1] interval. // samples uniform from [0,1] interval.
return ((float)xorshift32(seed)) / ((float)UINT32_MAX); return ((float)xorshift32(seed)) / ((float)UINT32_MAX);
} }
@ -50,7 +50,6 @@ float sample_uniform(float from, float to, uint32_t* seed)
return sample_unit_uniform(seed) * (to - from) + from; return sample_unit_uniform(seed) * (to - from) + from;
} }
float sample_normal(float mean, float sigma, uint32_t* seed) float sample_normal(float mean, float sigma, uint32_t* seed)
{ {
return (mean + sigma * sample_unit_normal(seed)); return (mean + sigma * sample_unit_normal(seed));
@ -63,9 +62,9 @@ float sample_lognormal(float logmean, float logsigma, uint32_t* seed)
float sample_to(float low, float high, uint32_t* seed) float sample_to(float low, float high, uint32_t* seed)
{ {
// Given a (positive) 90% confidence interval, // Given a (positive) 90% confidence interval,
// returns a sample from a lognormal // returns a sample from a lognormal
// with a matching 90% c.i. // with a matching 90% c.i.
const float NORMAL95CONFIDENCE = 1.6448536269514722; const float NORMAL95CONFIDENCE = 1.6448536269514722;
float loglow = logf(low); float loglow = logf(low);
float loghigh = logf(high); float loghigh = logf(high);