squiggle.c/scratchpad/scratchpad.c

24 lines
605 B
C
Raw Normal View History

2023-09-27 13:10:40 +00:00
#include "../squiggle.h"
2023-11-29 23:08:36 +00:00
#include "../squiggle_more.h"
2023-09-27 13:10:40 +00:00
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
// set randomness seed
uint64_t* seed = malloc(sizeof(uint64_t));
*seed = 1000; // xorshift can't start with a seed of 0
2023-11-29 23:08:36 +00:00
int n = 1000000;
double* xs = malloc(sizeof(double) * n);
for (int i = 0; i < n; i++) {
xs[i] = sample_to(10, 100, seed);
2023-11-29 23:08:36 +00:00
}
ci ci_90 = array_get_90_ci(xs, n);
printf("Recovering confidence interval of sample_to(10, 100):\n low: %f, high: %f\n", ci_90.low, ci_90.high);
2023-09-27 13:10:40 +00:00
free(seed);
}