AS3 randomize array


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function randomizeArray(array:Array):Array{
  2. var newArray:Array = new Array();
  3. while(array.length > 0){
  4. newArray.push(array.splice(Math.floor(Math.random()*array.length), 1));
  5. }
  6. return newArray;
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.