diff options
| author | Tyge Løvset <[email protected]> | 2020-12-16 10:58:04 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-12-16 10:58:04 +0100 |
| commit | a147a1be246472d079f72fc22e065080d1588e29 (patch) | |
| tree | d01c8965999f86cd46a51cf6ac3e2920adb238a0 /examples/queue.c | |
| parent | 12d7c1b3ca437af8734acc8e7cbfdba08b8c36df (diff) | |
| download | STC-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 'examples/queue.c')
| -rw-r--r-- | examples/queue.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/queue.c b/examples/queue.c index 0ff29736..57362493 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;
- cstc64_uniform_t dist;
- cstc64_t rng = cstc64_init(1234);
- dist = cstc64_uniform_init(0, n);
+ crand_uniform_t dist;
+ crand_t rng = crand_init(1234);
+ dist = crand_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, cstc64_uniform(&rng, &dist));
+ cqueue_i_push(&queue, crand_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 = cstc64_uniform(&rng, &dist);
+ int r = crand_uniform(&rng, &dist);
if (r & 1)
++n, cqueue_i_push(&queue, r);
else
|
