forked from probsys/fast-loaded-dice-roller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.c
More file actions
28 lines (23 loc) · 652 Bytes
/
Copy pathexample.c
File metadata and controls
28 lines (23 loc) · 652 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Name: example.c
Purpose: Example of running FLDR.
Author: F. A. Saad
Copyright (C) 2020 Feras A. Saad, All Rights Reserved.
Released under Apache 2.0; refer to LICENSE.txt
*/
#include <stdlib.h>
#include <stdio.h>
#include "fldr.h"
int main(int argc, char **argv) {
int N_sample = 100;
int *samples = calloc(N_sample, sizeof(*samples));
int distribution[5] = { 1, 1, 2, 3, 1 };
fldr_preprocess_t *x = fldr_preprocess(distribution, 5);
for (int i = 0; i < N_sample; i++) {
samples[i] = fldr_sample(x);
printf("%d ", samples[i]);
}
printf("\n");
free(samples);
fldr_free(x);
}