Skip to content

Instantly share code, notes, and snippets.

@furf
Forked from madrobby/gist:333764
Created March 16, 2010 14:14
Show Gist options
  • Save furf/334002 to your computer and use it in GitHub Desktop.
Save furf/334002 to your computer and use it in GitHub Desktop.
// pure JS
function shuffle(array) {
return array.sort(function(){
return .5 - Math.random();
});
}
// with Prototype.js you can do
function shuffle(array){
return array.sortBy(Math.random);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment