Skip to content

Instantly share code, notes, and snippets.

@sim642
Created August 6, 2011 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sim642/1129304 to your computer and use it in GitHub Desktop.
Save sim642/1129304 to your computer and use it in GitHub Desktop.
#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