Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function shuffle(l) {
- var plucked = [],
- len = l.length;
- while (plucked.length < len) {
- var idx = parseInt(Math.random() * l.length);
- plucked.push( l.splice(idx, 1)[0] );
- }
- return plucked;
- }
- var l = [1,2,3,4,5];
- l = shuffle(l);
Add Comment
Please, Sign In to add comment