Fix IndexShardRoutingTable's shard randomization to not throw out-of-bounds
exceptions.

Close #5559