Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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