Randomize an Array


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. for (var i:uint = 0; i < myArray.length; i++)
  2. {
  3. var rand:uint = int(Math.random() * myArray.length);
  4. myArray.push( myArray.splice( rand, 1 )[0] );
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.