in reply to A little golfing challenge: replace digits by random letters

Not a perfect shuffle, but close (enough?) and much shorter:

perl -M5';$x=join"",sort{rand()<rand}a..z' -pe 'eval"tr/0-9/$x/"' input.txt

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit

Replies are listed 'Best First'.
Re^2: A little golfing challenge: replace digits by random letters
by bliako (Abbot) on Feb 10, 2019 at 13:02 UTC

    half-blind-sort is a great idea (and so is {rand()<rand} ).

    Couldn't resist sort{rand(2)-1} as it's shorter by 2 and truer blind.

    Update/Correction: as vr rightly notes, int(rand(2)-1) is constantly 0!!! Because sort expects an integer back from the comparison BLOCK and int()'ing rand(2)-1 leaves just 0 :(. So, both these compensate for that bug and are uniformly random too: sort{rand(6)-4} and sort{1-rand(3)%3}

      Perhaps sort{rand(2)-1} (in effect, same as sort{0}) is somewhat too deterministic :). But

      $ perl -E 'say sort{rand 2}a..z'

      produces random enough strings, and is shorter.

        ai! indeed it is. got bitten by int. This is uniformly random sort{rand(6)-4} and so is this sort{1-rand(3)%3}