Skip to content

Instantly share code, notes, and snippets.

@roblogic
Last active August 12, 2019 03:50
Show Gist options
  • Select an option

  • Save roblogic/d1c7d3017a98648939f059e0378f03c3 to your computer and use it in GitHub Desktop.

Select an option

Save roblogic/d1c7d3017a98648939f059e0378f03c3 to your computer and use it in GitHub Desktop.
Zsh solution for golf challenge https://codegolf.stackexchange.com/a/189756/15940
#!/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