Return to Snippet

Revision: 11091
at January 23, 2009 03:56 by Meestercor


Initial Code
	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)
    }

Initial URL

                                

Initial Description

                                

Initial Title
array shuffle flash AS2

Initial Tags
textmate, array

Initial Language
Other