shuffle the Array

by Mohan 2012-09-20 22:39:26


shuffle the Array
JavaScript 1.?
var list = [1,2,3,4,5,6,7,8,9];

list = list.sort(function() Math.random() - 0.5);

Print(list); // prints something like: 4,3,1,2,9,5,6,7,8



Tagged in:

751
like
0
dislike
0
mail
flag

You must LOGIN to add comments