# JavaScript 6, 113 Bytes

    f=x=>(h=[...x].sort(_=>Math.random()>.5)).some((y,z)=>RegExp(y+(q=h[z+1]||h[0])+'|'+q+y).test(x+x))?f(x):h.join``

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    f=x=>(h=[...x].sort(_=>Math.random()>.5)).some((y,z)=>RegExp(y+(q=h[z+1]||h[0])+'|'+q+y).test(x+x))?f(x):h.join``

    console.log (f('abcdef'));

<!-- end snippet -->