Links

Search This Blog

June 28, 2022

JS shuffle 2

function shuffle2(a){
  var alen = a.length;
  var i = 0;
  var temp;
  while(alen > i){
     var c = Math.floor(Math.random()*alen);
     temp = a[c];
     a[c] = a[i];
     a[i] = temp;
     i++;
  }
 return a;
}

1 comment:

Anonymous said...

You are either JavaScripted or Python'd. If I any one could tell me why?

Post a Comment