summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/list.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-03-30 17:59:08 +0200
committerTyge Løvset <[email protected]>2023-03-30 17:59:08 +0200
commita0a290645828c88597efce80f6b0f5a958cefa89 (patch)
tree53dc78071653b515a06a60baf4488a1b6d080b32 /misc/examples/list.c
parent32df5677c9906661e91aad294e45a258e2eaab18 (diff)
downloadSTC-modified-a0a290645828c88597efce80f6b0f5a958cefa89.tar.gz
STC-modified-a0a290645828c88597efce80f6b0f5a958cefa89.zip
Added crand.h - Alternative API to crandom.h, which will be deprecated.
Diffstat (limited to 'misc/examples/list.c')
-rw-r--r--misc/examples/list.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/misc/examples/list.c b/misc/examples/list.c
index 9f0b2504..eb81067d 100644
--- a/misc/examples/list.c
+++ b/misc/examples/list.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <time.h>
#include <stc/algo/filter.h>
-#include <stc/crandom.h>
+#include <stc/crand.h>
#define i_type DList
#define i_val double
@@ -11,11 +11,10 @@ int main() {
const int n = 3000000;
DList list = {0};
- stc64_t rng = stc64_new(1234567);
- stc64_uniformf_t dist = stc64_uniformf_new(100.0f, n);
+ crand_t rng = crand_init(1234567);
int m = 0;
c_forrange (n)
- DList_push_back(&list, stc64_uniformf(&rng, &dist)), ++m;
+ DList_push_back(&list, crand_f64(&rng)*n + 100), ++m;
double sum = 0.0;
printf("sumarize %d:\n", m);