squiggle.c

Self-contained Monte Carlo estimation in C99
Log | Files | Refs | README

example.c (377B)


      1 #include "../../../squiggle.h"
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 
      5 // Estimate functions
      6 int main()
      7 {
      8     // set randomness seed
      9     uint64_t* seed = malloc(sizeof(uint64_t));
     10     *seed = 1000; // xorshift can't start with 0
     11 
     12     for (int i = 0; i < 100; i++) {
     13         double sample = sample_lognormal(0, 10, seed);
     14         printf("%f\n", sample);
     15     }
     16     free(seed);
     17 }