Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 264: Line 264:
function shuffle_array(array)
function shuffle_array(array)
{
{
-
     var counter= array.length, temp, index;
+
     for (var i = array.length - 1; i > 0; i--)
-
    while(counter--)
+
     {
     {
-
         index= Math.floor(Math.random() * counter);
+
         var j = Math.floor(Math.random() * (i + 1));
-
         temp= array[counter];
+
         var temp = array[i];
-
         array[counter]= array[index];
+
         array[i] = array[j];
-
         array[index]= temp;
+
         array[j] = temp;
     }
     }
     return array;
     return array;

Revision as of 23:20, 2 August 2013