Last active
April 1, 2017 13:14
-
-
Save deque-blog/e3625d2eb43c641dacd26b22c4b9f1c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename ValueGenerator> | |
auto make_vector_gen(int max_size, ValueGenerator value_generator) | |
{ | |
return [=](std::mt19937& gen) { | |
std::uniform_int_distribution<int> distribution (0, max_size); | |
std::vector<decltype(value_generator(gen))> out(distribution(gen)); | |
for (auto& val: out) val = value_generator(gen); | |
return out; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment