Last active
December 20, 2015 16:29
-
-
Save gasolin/6161823 to your computer and use it in GitHub Desktop.
This file contains 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
//shuffles list in-place | |
//credit http://dtm.livejournal.com/38725.html | |
function shuffle(list) { | |
var i, j, t; | |
for (i = 1; i < list.length; i++) { | |
j = Math.floor(Math.random()*(1+i)); // choose j in [0..i] | |
if (j != i) { | |
t = list[i]; // swap list[i] and list[j] | |
list[i] = list[j]; | |
list[j] = t; | |
} | |
} | |
} | |
var gaia_members = ['Yuren','Arthur','Dominic', | |
'Rex','Steve','Rudy','Alive', | |
'Evan','Mark','John','Fred','George','Ian','Greg','Jason']; | |
shuffle(gaia_members) | |
alert(gaia_members) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can run directly at http://jsfiddle.net/gasolin/SYYy2/