The story: A few obfus ago I had a bunch of lines that I wanted to randomize to keep the obfu from being deconstructed a little too quickly. So, I came up with a short script that I have since shortened to a one-liner:

123456789_123456789_123456789_123456789_123456789_123456789_1 perl -e'@l=<>;while(@l){$i=rand@l;print$l[$i];splice@l,$i,1}'

Scored in accordance with PGA Golf Rules, it hits the clubhouse at 61 chars. However, I'm sure there's probably much shorter ways out there that my feeble, cheese-filled mind isn't thinking of, and I figured some of you might get a little enjoyment out of this, so here we go...

Sample input:

This is some sample input that CheeseLord put here for you.

Sample output:

input that for you. put here CheeseLord is some sample This

Final Note: The space between -e and ' has proven optional everywhere I've tried it -- but if it turns out not to be somewhere, I'll gladly take the one-stroke penalty.

His Royal Cheeziness


In reply to (GOLF) Randomizing lines by CheeseLord

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.