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 /include/stc/cqueue.h | |
| 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 'include/stc/cqueue.h')
| -rw-r--r-- | include/stc/cqueue.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/stc/cqueue.h b/include/stc/cqueue.h index 67909f8e..1934305a 100644 --- a/include/stc/cqueue.h +++ b/include/stc/cqueue.h @@ -22,7 +22,7 @@ */ // STC queue /* -#include <stc/crandom.h> +#include <stc/crand.h> #include <stdio.h> #define i_key int @@ -30,19 +30,19 @@ int main() { int n = 10000000; - stc64_t rng = stc64_new(1234); - stc64_uniform_t dist = stc64_uniform_new(0, n); + crand_t rng = crand_init(1234); + crand_unif_t dist = crand_unif_init(0, n); c_auto (cqueue_int, Q) { // Push ten million random numbers onto the queue. for (int i=0; i<n; ++i) - cqueue_int_push(&Q, stc64_uniform(&rng, &dist)); + cqueue_int_push(&Q, crand_unif(&rng, &dist)); // Push or pop on the queue ten million times printf("before: size, capacity: %d, %d\n", n, cqueue_int_size(&Q), cqueue_int_capacity(&Q)); for (int i=n; i>0; --i) { - int r = stc64_uniform(&rng, &dist); + int r = crand_unif(&rng, &dist); if (r & 1) ++n, cqueue_int_push(&Q, r); else |
