How to pick color that will not be same next to each other
<p>I'm adding a random background color with this code</p>

<pre><code>var hue = ['#2dafe9','#5feec3','#fdaf17','#999999','#2b2b2b','#454323','#ab34ef', '#e324e2','#874edf','#18edf4'];
    function getHue(){
        return hue[Math.floor(Math.random() * hue.length)];
    }

    function rainbow(){
        $("header[role='postHeader']").each(function(){
                $(this).css('background-color',getHue());
        });
    }
    rainbow();
</code></pre>

<p>My question is, how to select a color in order of the array without having to same color next to each other in the result, so the color would follow the array order instead and then if its get to the last array loop back to the first one.</p>
