Last active
January 4, 2016 04:09
-
-
Save jdittrich/8566984 to your computer and use it in GitHub Desktop.
takes the array and prints out all its entrys once, in random order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright © 2014 jdittrich | |
This work is free. You can redistribute it and/or modify it under the | |
terms of the Do What The Fuck You Want To Public License, Version 2, | |
as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. | |
*/ | |
var shuffleThis = [1,2,3,4,5,6]; //put any numbers or strings here | |
while(shuffleThis.length>0){ | |
console.log( | |
shuffleThis.splice( | |
Math.floor( | |
Math.random()*shuffleThis.length-1 | |
)//floor end | |
,1)//splice end | |
[0]//1st element of splices array | |
);//console end | |
};//while end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment