Last active
August 12, 2019 03:50
-
-
Save roblogic/d1c7d3017a98648939f059e0378f03c3 to your computer and use it in GitHub Desktop.
Zsh solution for golf challenge https://codegolf.stackexchange.com/a/189756/15940
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| # using bits of https://codegolf.stackexchange.com/a/189073 | |
| # and https://codegolf.stackexchange.com/a/182568 | |
| for ((;i<$#1;i++)){ | |
| s=${1:$i:1} #current char | |
| m=${1:$i:2} #current and next char (length 2) | |
| m=$m:l$m:u #lower + upper cases (length 4) | |
| for ((t=0;t<$RANDOM%5;t++)){ | |
| x+=${m:$RANDOM%4:1} | |
| } | |
| printf $s$x | |
| x= | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment