From 5942e985c6ac9b18090ec92b11aa8a586b6365c5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 2 Jul 2021 13:54:45 -0400 Subject: Avoid use of rand() --- benchmark/tree_bench.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'benchmark/tree_bench.c') 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)) { -- cgit v1.2.1