in reply to A little golfing challenge: replace digits by random letters
rand knows all!
echo 123412341234 | perl -pe '$s=time;s/(.)/srand $s;rand for 1..$1;ch +r(ord("a")+rand 26)/ge'
bw, bliako
Edit: fixed the 'a' to "a" also a warning: this code should not be run more than once during one whole second, thanks Discipulus
Edit: Of course that warning is because of srand(time). Now this seeds and on something completely different: echo '01234567890123456789' | perl -pe '$s=time+join "",{}=~/(\d+)/g;s/(.)/srand $s;rand for 0..$1;chr(ord("a")+rand 26)/ge'. (👁️)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A little golfing challenge: replace digits by random letters
by Discipulus (Canon) on Feb 10, 2019 at 17:45 UTC | |
by bliako (Abbot) on Feb 10, 2019 at 19:44 UTC |