diff options
| author | Tyge Løvset <[email protected]> | 2023-03-30 17:59:08 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-03-30 17:59:08 +0200 |
| commit | a0a290645828c88597efce80f6b0f5a958cefa89 (patch) | |
| tree | 53dc78071653b515a06a60baf4488a1b6d080b32 /misc/examples/new_queue.c | |
| parent | 32df5677c9906661e91aad294e45a258e2eaab18 (diff) | |
| download | STC-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/new_queue.c')
| -rw-r--r-- | misc/examples/new_queue.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/misc/examples/new_queue.c b/misc/examples/new_queue.c index f7887ffb..044e44cb 100644 --- a/misc/examples/new_queue.c +++ b/misc/examples/new_queue.c @@ -1,4 +1,4 @@ -#include <stc/crandom.h> +#include <stc/crand.h> #include <stc/forward.h> #include <stdio.h> #include <time.h> @@ -22,20 +22,20 @@ int point_cmp(const Point* a, const Point* b) { int main() { int n = 50000000; - stc64_t rng = stc64_new((uint64_t)time(NULL)); - stc64_uniform_t dist = stc64_uniform_new(0, n); + crand_t rng = crand_init((uint64_t)time(NULL)); + crand_unif_t dist = crand_unif_init(0, n); IQ Q = {0}; // Push 50'000'000 random numbers onto the queue. c_forrange (n) - IQ_push(&Q, (int)stc64_uniform(&rng, &dist)); + IQ_push(&Q, (int)crand_unif(&rng, &dist)); // Push or pop on the queue 50 million times printf("befor: size %" c_ZI ", capacity %" c_ZI "\n", IQ_size(&Q), IQ_capacity(&Q)); c_forrange (n) { - int r = (int)stc64_uniform(&rng, &dist); + int r = (int)crand_unif(&rng, &dist); if (r & 3) IQ_push(&Q, r); else |
