5 deleted 2 characters in body
source | link

Ruby, 110 97 102 bytes

f=->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=(x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!

Ruby, 110 97 102 bytes

f=->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=(x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!

Ruby, 110 97 102 bytes

->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=(x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!

4 Fixed wrapping bug
source | link

Ruby, 110 9997 102 bytes

f=->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=x[i,2];a==s[i]||b&&b=(s[a+b]||s[b+a]x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!Try it online!

Ruby, 110 99 bytes

f=->s{x=s.chars
x.shuffle!while s.size.times.any?{|i|a,b=x[i,2];a==s[i]||b&&(s[a+b]||s[b+a])}
x*''}

Try it online!

Ruby, 110 97 102 bytes

f=->s{x=s.chars
t=s*2
x.shuffle!while s.size.times.any?{|i|a,b=(x*2)[i,2];a==s[i]||t[a+b]||t[b+a]}
x*''}

Try it online!

3 added 13 characters in body
source | link

Ruby, 110110 99 bytes

f=->s{x=s.chars
x.shuffle!while s.charssize.zip(x)times.any?{|a|i|a,b|a==b}||x.each_consb=x[i,2];a==s[i]||b&&(2s[a+b]||s[b+a]).any?{|a,b|s[a+b]||s[b+a]}
x*''}

Try it online!Try it online!

Ruby, 110 bytes

->s{x=s.chars
x.shuffle!while s.chars.zip(x).any?{|a,b|a==b}||x.each_cons(2).any?{|a,b|s[a+b]||s[b+a]}
x*''}

Try it online!

Ruby, 110 99 bytes

f=->s{x=s.chars
x.shuffle!while s.size.times.any?{|i|a,b=x[i,2];a==s[i]||b&&(s[a+b]||s[b+a])}
x*''}

Try it online!

2 edited body
source | link
1
source | link