Published in: JavaScript
URL: http://jsfromhell.com/array/shuffle
Scrambles the elements of an array. Created: 2005.11.03
/************************************** * Jonas Raoni Soares Silva * http://www.joninhas.ath.cx **************************************/ shuffle = function(v){ //v1.0 for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x); return v; };
You need to login to post a comment.
