diff options
author | David Robillard <d@drobilla.net> | 2018-08-26 20:52:56 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-29 14:50:31 +0200 |
commit | 845ff6488070a91dd8c021608fc391b5a79d01b2 (patch) | |
tree | 73698a7400bb40afc3b5fafe228d96f202b489f7 | |
parent | 5dff0a4139164bca303691305ad35e7dd06c1a10 (diff) | |
download | chilbert-845ff6488070a91dd8c021608fc391b5a79d01b2.tar.gz chilbert-845ff6488070a91dd8c021608fc391b5a79d01b2.tar.bz2 chilbert-845ff6488070a91dd8c021608fc391b5a79d01b2.zip |
Move make_random_point to test_utils.hpp
-rw-r--r-- | test/test_hilbert.cpp | 12 | ||||
-rw-r--r-- | test/test_utils.hpp | 15 |
2 files changed, 14 insertions, 13 deletions
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 <gmpxx.h> -/// Return a `D`-dimensional point with `M` bits of precision per dimension -template <size_t M, size_t D> -std::array<uint64_t, D> -make_random_point(Context& ctx) -{ - std::array<uint64_t, D> 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 <size_t D> std::array<uint64_t, D> 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<size_t, D> make_random_precisions(Context& ctx) { std::array<size_t, D> 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 <size_t M, size_t D> +std::array<uint64_t, D> +make_random_point(Context& ctx) +{ + std::array<uint64_t, D> p; + for (size_t i = 0; i < D; ++i) { + p[i] = rand_between(ctx, 0, (1UL << M) - 1); + } + return p; +} + #endif |