2023-07-16 19:00:30 +00:00
|
|
|
#ifndef SQUIGGLEC
|
|
|
|
#define SQUIGGLEC
|
2023-06-26 17:44:41 +00:00
|
|
|
|
2023-07-16 19:00:30 +00:00
|
|
|
// uint32_t header
|
|
|
|
#include <stdint.h>
|
2023-06-26 17:44:41 +00:00
|
|
|
|
|
|
|
// Pseudo Random number generator
|
2023-07-16 19:00:30 +00:00
|
|
|
uint32_t xorshift32(uint32_t* seed);
|
2023-06-26 17:44:41 +00:00
|
|
|
|
|
|
|
// Distribution & sampling functions
|
2023-07-16 19:00:30 +00:00
|
|
|
float rand_0_to_1(uint32_t* seed);
|
|
|
|
float rand_float(float max, uint32_t* seed);
|
|
|
|
float ur_normal(uint32_t* seed);
|
|
|
|
float random_uniform(float from, float to, uint32_t* seed);
|
|
|
|
float random_normal(float mean, float sigma, uint32_t* seed);
|
|
|
|
float random_lognormal(float logmean, float logsigma, uint32_t* seed);
|
|
|
|
float random_to(float low, float high, uint32_t* seed);
|
2023-06-26 17:44:41 +00:00
|
|
|
|
|
|
|
// Array helpers
|
2023-07-16 19:00:30 +00:00
|
|
|
float array_sum(float* array, int length);
|
|
|
|
void array_cumsum(float* array_to_sum, float* array_cumsummed, int length);
|
2023-06-26 17:44:41 +00:00
|
|
|
|
|
|
|
// Mixture function
|
2023-07-16 19:00:30 +00:00
|
|
|
float mixture(float (*samplers[])(uint32_t*), float* weights, int n_dists, uint32_t* seed);
|
2023-06-26 17:44:41 +00:00
|
|
|
|
2023-07-16 19:00:30 +00:00
|
|
|
#endif
|