/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
static public function shuffle(orgArray:Array):Array{ var newArray = new Array(); while (orgArray.length>0){ newArray.push(orgArray.splice(randomRange(0,orgArray.length), 1)); } return newArray; } static public function randomRange(min:Number,max:Number){ if(min==null)min=Number.NEGATIVE_INFINITY; if(max==null)max=Number.POSITIVE_INFINITY; return Math.floor(Math.random()*(max-min)+min) }