From eaedbed0693a96f359cf7f19f9151d62a76d13d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Tue, 9 Jul 2019 20:02:06 +0300 Subject: [PATCH] tests/random: add get_bool() overload with random engine param --- tests/random-utils.hh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/random-utils.hh b/tests/random-utils.hh index e2bdf79641..80ace220f9 100644 --- a/tests/random-utils.hh +++ b/tests/random-utils.hh @@ -129,9 +129,14 @@ Real get_real() { return get_real(Real{0}, std::numeric_limits::max(), gen()); } -inline bool get_bool() { +template +inline bool get_bool(RandomEngine& engine) { static std::bernoulli_distribution dist; - return dist(gen()); + return dist(engine); +} + +inline bool get_bool() { + return get_bool(gen()); } inline bytes get_bytes(size_t n) {