Guest User

Untitled

a guest
Dec 11th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. function shuffle(l) {
  2. var plucked = [],
  3. len = l.length;
  4. while (plucked.length < len) {
  5. var idx = parseInt(Math.random() * l.length);
  6. plucked.push( l.splice(idx, 1)[0] );
  7. }
  8. return plucked;
  9. }
  10.  
  11. var l = [1,2,3,4,5];
  12. l = shuffle(l);
Add Comment
Please, Sign In to add comment