summaryrefslogtreecommitdiffhomepage
path: root/stc/cqueue.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-16 10:58:04 +0100
committerTyge Løvset <[email protected]>2020-12-16 10:58:04 +0100
commita147a1be246472d079f72fc22e065080d1588e29 (patch)
treed01c8965999f86cd46a51cf6ac3e2920adb238a0 /stc/cqueue.h
parent12d7c1b3ca437af8734acc8e7cbfdba08b8c36df (diff)
downloadSTC-modified-a147a1be246472d079f72fc22e065080d1588e29.tar.gz
STC-modified-a147a1be246472d079f72fc22e065080d1588e29.zip
Reverted back API to easier naming scheme of crandom.h types and methods.
Highly optimized generation of unbiased uniform bounded random numbers. Only 33% overhead.
Diffstat (limited to 'stc/cqueue.h')
-rw-r--r--stc/cqueue.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/stc/cqueue.h b/stc/cqueue.h
index 6226b59b..f385aa4a 100644
--- a/stc/cqueue.h
+++ b/stc/cqueue.h
@@ -32,19 +32,19 @@
int main() {
int n = 10000000;
- cstc64_t gen = cstc64_init(1234);
- cstc64_uniform_t dist = cstc64_uniform_init(gen, 0, n);
+ crand_t rng = crand_init(1234);
+ crand_uniform_t dist = crand_uniform_init(rng, 0, n);
cqueue_i queue = cqueue_i_init();
// Push ten million random numbers onto the queue.
for (int i=0; i<n; ++i)
- cqueue_i_push(&queue, cstc64_uniform(&dist));
+ cqueue_i_push(&queue, crand_uniform(&dist));
// Push or pop on the queue ten million times
printf("%d\n", n);
for (int i=n; i>0; --i) {
- int r = cstc64_uniform(&dist);
+ int r = crand_uniform(&dist);
if (r & 1)
++n, cqueue_i_push(&queue, r);
else