summaryrefslogtreecommitdiffhomepage
path: root/examples/queue.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-14 23:00:15 +0100
committerTyge Løvset <[email protected]>2020-12-14 23:00:15 +0100
commita51861d02f9d8ed8c69fd243de18960307b0fd63 (patch)
tree0684859662ced33942942045652f45f65a07ee35 /examples/queue.c
parentf08c1bf0fdf00039f9431677a4038c03696a5e01 (diff)
downloadSTC-modified-a51861d02f9d8ed8c69fd243de18960307b0fd63.tar.gz
STC-modified-a51861d02f9d8ed8c69fd243de18960307b0fd63.zip
Reworked the crandom.h module. Changed API (sorry!), made uniform distr. unbiased. Removed 32-bit pcg32 PRNG.
Diffstat (limited to 'examples/queue.c')
-rw-r--r--examples/queue.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/queue.c b/examples/queue.c
index c56214a7..0ff29736 100644
--- a/examples/queue.c
+++ b/examples/queue.c
@@ -7,20 +7,20 @@ using_cqueue(i, clist_i); // min-heap (increasing values)
int main() {
int n = 10000000;
- crand_uniform_i32_t dist;
- crand_rng32_t rng = crand_rng32_init(1234);
- dist = crand_uniform_i32_init(0, n);
+ cstc64_uniform_t dist;
+ cstc64_t rng = cstc64_init(1234);
+ dist = cstc64_uniform_init(0, n);
cqueue_i queue = cqueue_i_init();
// Push ten million random numbers onto the queue.
c_forrange (n)
- cqueue_i_push(&queue, crand_uniform_i32(&rng, &dist));
+ cqueue_i_push(&queue, cstc64_uniform(&rng, &dist));
// Push or pop on the queue ten million times
printf("%d\n", n);
c_forrange (n) { // range uses initial n only.
- int r = crand_uniform_i32(&rng, &dist);
+ int r = cstc64_uniform(&rng, &dist);
if (r & 1)
++n, cqueue_i_push(&queue, r);
else