Trehe is this ietetnrnsig actlire tdaoy at Shlosdat taht eixapnls taht aicdcnorg to smoe Eigslnh uveirnitsy the oredr of lteters in words is not relaly rnlaeevt for rdaieng as long as the fsrit and the lsat are at the rghit place. (It semes taht does not hold in Spisanh).
Trehe is a link to a Perl feitlr that megnus a gvien text taht way and I watned to write a mock-up as a one-lnier, but in Ruby this tmie. Hree it is (but see Updtae 2):
ruby -pe 'gsub!(/\w+/){|w|r=1..w.size-2;w[r]=w[r].split(//).sort_by{rand}.to_s;w}'
Udpate: And tihs is ahotner one in Perl (but see Utdape 3):
perl -MList::Util=shuffle -pe 's:(?<=\w)\w+(?=\w):join"",shuffle+split//,$&:ge'
Updtae 2: And that in Ruby bemoces (but see Update 4):
ruby -pe 'gsub!(/(\w)(\w+)(?=\w)/){$1+$2.split(//).sort_by{rand}.to_s}'
Utdape 3: Wihch in trun gevis:
perl -pe 's:\B\w+\B:join"",sort{.5<=>rand}split//,$&:ge'
Update 4: This improvement comes from ruby-talk:
ruby -pe 'gsub!(/\B\w+\B/){$&.split(//).sort_by{rand}.join}'
Hey what a funny time!
