diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/heap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/heap.c b/examples/heap.c index bca5f2e7..cc8d1df1 100644 --- a/examples/heap.c +++ b/examples/heap.c @@ -18,13 +18,13 @@ int main() pcg = crand_rng32_init(seed);
clock_t start = clock();
c_forrange (i, int, N)
- cvec_f_push_back(&pq, (float) crand_i32(&pcg));
+ cvec_f_push_back(&pq, (float) crand_f32(&pcg)*100000);
cpqueue_f_make_heap(&pq);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
c_forrange (i, int, M)
- printf("%.0f ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
+ printf("%g ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
start = clock();
c_forrange (i, int, M, N)
@@ -34,11 +34,11 @@ int main() pcg = crand_rng32_init(seed);
start = clock();
c_forrange (i, int, N)
- cpqueue_f_push(&pq, (float) crand_i32(&pcg));
+ cpqueue_f_push(&pq, (float) crand_f32(&pcg)*100000);
printf("pushed PQ: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
c_forrange (i, int, M)
- printf("%.0f ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
+ printf("%g ", *cpqueue_f_top(&pq)), cpqueue_f_pop(&pq);
puts("");
cpqueue_f_del(&pq);
|
