From 845ff6488070a91dd8c021608fc391b5a79d01b2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 26 Aug 2018 20:52:56 +0200 Subject: Move make_random_point to test_utils.hpp --- test/test_hilbert.cpp | 12 ------------ test/test_utils.hpp | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/test_hilbert.cpp b/test/test_hilbert.cpp index 307dbae..1d32668 100644 --- a/test/test_hilbert.cpp +++ b/test/test_hilbert.cpp @@ -27,18 +27,6 @@ #include -/// Return a `D`-dimensional point with `M` bits of precision per dimension -template -std::array -make_random_point(Context& ctx) -{ - std::array p; - for (size_t i = 0; i < D; ++i) { - p[i] = rand_between(ctx, 0, (1UL << M) - 1); - } - return p; -} - /// Return a `D`-dimensional point within `ms` per-dimension precision template std::array diff --git a/test/test_utils.hpp b/test/test_utils.hpp index 7c52f56..63b760c 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -72,7 +72,8 @@ std::array make_random_precisions(Context& ctx) { std::array ms; - size_t bits_left = N; + + size_t bits_left = N; for (size_t i = 0; i < D; ++i) { ms[i] = rand_between(ctx, 1, std::min(Max, bits_left / (D - i) + 1)); bits_left -= ms[i]; @@ -81,4 +82,16 @@ make_random_precisions(Context& ctx) return ms; } +/// Return a `D`-dimensional point with `M` bits of precision per dimension +template +std::array +make_random_point(Context& ctx) +{ + std::array p; + for (size_t i = 0; i < D; ++i) { + p[i] = rand_between(ctx, 0, (1UL << M) - 1); + } + return p; +} + #endif -- cgit v1.2.1