Created
August 6, 2011 12:27
-
-
Save sim642/1129304 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
#include <iostream> | |
#include <algorithm> | |
#include <ctime> | |
#include <boost/regex.hpp> | |
using namespace std; | |
int main() | |
{ | |
srand(time(0)); | |
string str = "Maybe someone who is not crap 1234 at programming can help yo"; | |
const boost::regex r("[A-Za-z]+"); | |
cout << boost::regex_replace(str, r, [](boost::smatch what) | |
{ | |
string s = what.str(); | |
random_shuffle(s.begin() + 1, s.end() - 1, [](ptrdiff_t i) | |
{ | |
return rand() % i; | |
}); | |
return s; | |
}) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment