in reply to Re: A little golfing challenge: replace digits by random letters
in thread A little golfing challenge: replace digits by random letters
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}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A little golfing challenge: replace digits by random letters
by vr (Curate) on Feb 10, 2019 at 14:12 UTC | |
by bliako (Abbot) on Feb 10, 2019 at 15:28 UTC |