Created
April 18, 2017 09:04
-
-
Save deque-blog/9c368a6719418f6cadd1e5c19dc1617c 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 Container> | |
auto choice_gen(Container const& values) | |
{ | |
return [=](std::mt19937& bit_gen) -> typename Container::value_type | |
{ | |
std::uniform_int_distribution<int> distribution(0, values.size() - 1); | |
return values[distribution(bit_gen)]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment