Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <random>
- #include <string>
- #include <utility>
- template<typename URNG>
- std::string make_random_string(std::size_t length, URNG&& generator) {
- std::uniform_int_distribution<int> distribution(0x21, 0x7E);
- std::string result;
- while(length) {
- result += distribution(std::forward<URNG>(generator));
- --length;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement