elasticsearch/elasticsearch — pull request #5561 by jpountz (2014-03-26 23:47:39+00:00)
Title: Fix IndexShardRoutingTable's shard randomization to not throw out-of-bounds exceptions.

I initially wanted to make the diff minimal but this ended up being quite complicated
so I finally refactored a bit the way shards are randomized. Yet, it uses the same logic:
- rotations to shuffle shards,
- an AtomicInteger to generate the distances to use for the rotations.

Close #5559