Skip to content

Instantly share code, notes, and snippets.

@molarmanful
Last active August 29, 2015 14:24
Show Gist options
  • Save molarmanful/9e711a375d2c642bed0c to your computer and use it in GitHub Desktop.
Save molarmanful/9e711a375d2c642bed0c to your computer and use it in GitHub Desktop.
Javascript-golfed Fisher-Yates Shuffle algorithms, dependent only on the Math.random function (basically, it's cross-browser). Each function takes an array as input and outputs scrambled array.
function(a){for(b=a.length;b;a[b]=[a[c],a[c]=a[b]][0])c=0|Math.random()*b--;return a}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment