Skip to content

Instantly share code, notes, and snippets.

@carlosasin
Created August 20, 2013 15:51
Show Gist options
  • Save carlosasin/6283316 to your computer and use it in GitHub Desktop.
Save carlosasin/6283316 to your computer and use it in GitHub Desktop.
JS - Shuffle array
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/array/shuffle [v1.0]
function shuffle(o){ //v1.0
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment