This was my effort:
perl -pe
's|(\w)(\w+)(?=\w)|$1.join"",sort{rand 2}split//,$2|ge'
12345678901234567890123456789012345678901234567890123
10 20 30 40 50
Edit:
perl -pe
's|\B(\w+)\B|join"",sort{rand 2}split//,$1|ge'
The golf has more perceptually random results than the other variants posted here which are shorted than it. It doesn't have an even distibution of results tho; words longer than 5 characters have certain permiatations which are more likely to come up. There's an example in the <readmore>.
Permiatations of the world "abcdef", and the likelyhood based on testing of it occuring rounded to fractions:
abcdef: 1/ 8
abcedf: 1/ 8
acbdef: 1/ 8
acbedf: 1/ 8
adbcef: 1/32
adbecf: 1/32
adcbef: 1/32
adcebf: 1/32
adebcf: 1/16
adecbf: 1/16
aebcdf: 1/32
aebdcf: 1/32
aecbdf: 1/32
aecdbf: 1/32
aedbcf: 1/16
aedcbf: 1/16
xxx
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.