From 555d628e9b250868c9da003e4407087ff1982e8e Mon Sep 17 00:00:00 2001 From: Allison Piper Date: Fri, 12 Apr 2024 11:55:05 -0400 Subject: [PATCH] Use a reproducible seed in test rng. (#164) --- testing/stdrel_criterion.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/stdrel_criterion.cu b/testing/stdrel_criterion.cu index 326196a..f0affea 100644 --- a/testing/stdrel_criterion.cu +++ b/testing/stdrel_criterion.cu @@ -41,8 +41,8 @@ void test_const() std::vector generate(double mean, double rel_std_dev, int size) { - std::random_device rd; - std::mt19937 gen(rd()); + static std::mt19937::result_type seed = 0; + std::mt19937 gen(seed++); std::vector v(static_cast(size)); std::normal_distribution dist(mean, mean * rel_std_dev); std::generate(v.begin(), v.end(), [&]{ return dist(gen); });