From @Raymond Hettinger we get this tip
#python tip: random.shuffle() is an in-place operation that operates on any mutable sequence. To shuffle in-line or to work from an immutable sequence, use random.sample() instead: >>> s = ‘hello world’ >>> ”.join(random.sample(s, k=len(s))) ‘lld erlohwo’
>>> s = 'hello world' >>> ''.join(random.sample(s, k=len(s))) 'lld erlohwo'