Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <random>
- int main()
- {
- std::string name = "some test";
- auto random_case = [] (auto &name) -> void
- {
- std::transform(name.begin(), name.end(),
- name.begin(),
- [] (unsigned char ch) -> unsigned char
- {
- static std::random_device rd;
- std::uniform_int_distribution<int> dist(0, 1);
- return dist(rd) ? std::toupper(ch) : std::tolower(ch);
- });
- };
- random_case(name);
- std::cout << name << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement