jquery get the unreapeatable values
<p>i have a array with numbers. i need that array value to be generated once i click on the button, while i click on the button i need to get the value random wise from the array, but the value should not be repeated. </p>

<p>ex, if i get a 2 from out of 5, then i should not get the 2 again. for this i wrote this function, but the values are repeating... any idea?</p>

<pre><code>var ar = [0,1,2,3,4,5];
var ran = Math.floor(Math.random()*ar.length);
ar.splice(ran,1);
alert(ar.splice);
</code></pre>

<p>the array values should not be removed. because if i click the button again, i need to get the values like before.</p>

<p>i did my work like this : but the rand values are repeating, any one can correct this to get unrepeatable values to get?</p>

<pre><code> $(document).ready(function(){
        var myArray = [1,2,3,4,5];
        var mySize = 5;
        x = 0;
        while(mySize&gt;=1){
            var rand = Math.floor(Math.random()*mySize);
            mySize--;
            alert(rand);
        }

    })
</code></pre>
