Skip to content
Snippets Groups Projects
Commit aec9aad1 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[T] Fill std::array randomly

parent 7ea621d4
No related branches found
No related tags found
No related merge requests found
...@@ -42,3 +42,16 @@ inline void fillVectorRandomly(std::vector<double>& x) ...@@ -42,3 +42,16 @@ inline void fillVectorRandomly(std::vector<double>& x)
value = rnd(random_number_generator); 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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment