diff --git a/Tests/VectorUtils.h b/Tests/VectorUtils.h index a8548415588c2ecfc67cd5699d3c761afe825b7c..78cba91f96f0356091697305bfade2236f55d8e7 100644 --- a/Tests/VectorUtils.h +++ b/Tests/VectorUtils.h @@ -42,3 +42,16 @@ inline void fillVectorRandomly(std::vector<double>& x) value = rnd(random_number_generator); } } + +template <std::size_t N> +void fillVectorRandomly(std::array<double, N>& x) +{ + std::random_device rd; + std::mt19937 random_number_generator(rd()); + std::uniform_real_distribution<double> rnd; + + for (auto& value : x) + { + value = rnd(random_number_generator); + } +}