View Single Post
Old 03-30-2008, 01:40 AM  
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,386
There is no PHP-like shuffle function in JavaScript, so you have to do it like this:
Code:
shuffle = function(myArray) { 
	for (var tmp, j, i = myArray.length; i; j = parseInt(Math.random()*i), tmp = myArray[--i], myArray[i] = myArray[j], myArray[j] = tmp);
	return myArray;
};
__________________
Obey the Cowgod

Last edited by just a punk; 03-30-2008 at 01:41 AM..
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote