I have an array of elements, which have a common attribute and are sorted by this attribute. Now, I want to achieve the opposite effect: interleave elements with the same attribute value as much as possible.

```
[
{a: 1},
{a: 1},
{a: 2},
{a: 2},
{a: 2},
{a: 3},
{a: 3},
{a: 3},
{a: 3},
].scatter_somehow
# =>
[
{a: 3},
{a: 1},
{a: 2},
{a: 3},
{a: 2},
{a: 1},
{a: 3},
{a: 2},
{a: 3},
]
```

If there was the same number of elements for each value of `a`

, I could have grouped them, then zipped the arrays and flattened the result. But `Array#zip`

stops as soon as there are no elements in the smallest array.

How would I do that?