Created
November 1, 2012 02:31
-
-
Save mbolt35/3991280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We return -1 if val1 is first, 1 if val2 is first, and 0 | |
// if we don't care - just return a random value between | |
// -1 and 1 | |
function shuffle(val1:int, val2:int):int { | |
var random:int = Math.floor(Math.random() * 3) - 1; | |
return random; | |
} | |
var toSort:Array = [ 1, 2, 3, 4, 5 ]; | |
toSort.sort(shuffle); | |
trace(toSort); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment