JavaScript - shuffle the Array

by Subramanian 2012-09-14 12:05:41

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:

615
like
0
dislike
0
mail
flag

You must LOGIN to add comments