Skip to content

Instantly share code, notes, and snippets.

@mbolt35
Created November 1, 2012 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbolt35/3991280 to your computer and use it in GitHub Desktop.
Save mbolt35/3991280 to your computer and use it in GitHub Desktop.
// 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