squiggle.c/scratchpad/uncorrelated/uncorrelated.c

25 lines
540 B
C
Raw Normal View History

// uncorrelated samples
#include "../../squiggle.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
float draw_xyz(uint32_t* seed){
// function could also be placed inside main with gcc nested functions extension.
return sample_to(1, 20, seed);
}
int main(){
// set randomness seed
uint32_t* seed = malloc(sizeof(uint32_t));
*seed = 1000; // xorshift can't start with 0
float a = draw_xyz(seed);
float b = 2 * draw_xyz(seed);
float c = b / a;
printf("a: %f, b: %f, c: %f\n", a, b, c);
}