summaryrefslogtreecommitdiffstats
path: root/benchmark/tree_bench.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-07-02 13:54:45 -0400
committerDavid Robillard <d@drobilla.net>2021-07-17 19:58:17 -0400
commit5942e985c6ac9b18090ec92b11aa8a586b6365c5 (patch)
treece66d68e863df9ecba01c16dfe1a5bc7100068f0 /benchmark/tree_bench.c
parentbc264ab6f58177124d49a72b4a808eb97fa2cb25 (diff)
downloadzix-5942e985c6ac9b18090ec92b11aa8a586b6365c5.tar.gz
zix-5942e985c6ac9b18090ec92b11aa8a586b6365c5.tar.bz2
zix-5942e985c6ac9b18090ec92b11aa8a586b6365c5.zip
Avoid use of rand()
Diffstat (limited to 'benchmark/tree_bench.c')
-rw-r--r--benchmark/tree_bench.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/benchmark/tree_bench.c b/benchmark/tree_bench.c
index bd274b1..9e399ba 100644
--- a/benchmark/tree_bench.c
+++ b/benchmark/tree_bench.c
@@ -17,6 +17,8 @@
#include "bench.h"
#include "warnings.h"
+#include "../test/test_data.h"
+
#include "zix/btree.h"
#include "zix/common.h"
#include "zix/tree.h"
@@ -35,22 +37,6 @@ ZIX_RESTORE_WARNINGS
// #define BENCH_SORTED_ARRAY 1
-// Return a pseudo-pseudo-pseudo-random-ish integer with no duplicates
-static size_t
-unique_rand(size_t i)
-{
- i ^= 0x5CA1AB1Eu; // Juggle bits to avoid linear clumps
-
- // Largest prime < 2^32 which satisfies (2^32 = 3 mod 4)
- static const size_t prime = 4294967291;
- if (i >= prime) {
- return i; // Values >= prime are mapped to themselves
- }
-
- const size_t residue = ((uint64_t)i * i) % prime;
- return (i <= prime / 2) ? residue : prime - residue;
-}
-
static int
int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data))
{