add sample_laplace

This commit is contained in:
NunoSempere 2023-08-11 14:01:02 +02:00
parent 91ab0d27dc
commit fb6edbff0c
2 changed files with 5 additions and 0 deletions

View File

@ -134,6 +134,10 @@ double sample_beta(double a, double b, uint64_t* seed)
return gamma_a / (gamma_a + gamma_b);
}
double sample_laplace(double successes, double failures, uint64_t* seed){
return sample_beta(successes + 1, failures + 1, seed);
}
// Array helpers
double array_sum(double* array, int length)
{

View File

@ -19,6 +19,7 @@ double sample_to(double low, double high, uint64_t* seed);
double sample_gamma(double alpha, uint64_t* seed);
double sample_beta(double a, double b, uint64_t* seed);
double sample_laplace(double successes, double failures, uint64_t* seed);
// Array helpers
double array_sum(double* array, int length);