title: Special shuffling of the array
body: <p>I want to shuffle my numpy array <code>a = [2, 2, 2, 1, 1]</code> in this way: <code>a = [2, 1, 2, 1, 2]</code>. So that the same elements do not stand side by side if possible. I know about <code>numpy.array.shuffle</code> but it generates all possible permutations uniformly. Therefore, with the same probability, can appear <code>a = [2, 1, 2, 1, 2]</code> or <code>a = [2, 2, 2, 1, 1]</code>. Is there vectorised solution for more difficult arrays? For example, for this <code>b = np.hstack([np.ones(101), np.ones(50) * 2, np.ones(20) * 3])</code> array.</p>