Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 260: Line 260:
  simulations[simid].timeout= setTimeout(function() {simbox_refresh(simid);}, simulations[simid].refresh_interval);
  simulations[simid].timeout= setTimeout(function() {simbox_refresh(simid);}, simulations[simid].refresh_interval);
 +
}
 +
 +
function shuffle_array(array)
 +
{
 +
    var counter= array.length, temp, index;
 +
    while(counter--)
 +
    {
 +
        index= (Math.random() * counter) | 0;
 +
        temp= array[counter];
 +
        array[counter]= array[index];
 +
        array[index]= temp;
 +
    }
}
}
function simulation_step(simid)
function simulation_step(simid)
{
{
-
   
+
  //randomize order
 +
var indexes= new Array();
 +
for(var i= 0 ; i < simulations[simid].reactions.length ; ++i)
 +
  indexes[i]= i;
 +
shuffle_array(indexes);
 +
alert(indexes[0]);
}
}

Revision as of 23:14, 2 August 2013