I'd do it like this:

Take a new array,
take a random element from the oldArray and remove it from the oldArray. Then put it as the next element in the newArray.

like so:

var oldArray:Array = ["item1","item2","item3","item4","item5","item6"];
var newArray:Array = [];

while (oldArray.length) {
   newArray.push(oldArray.splice(Math.random()*oldArray.length,1));
}

trace(newArray);

// Luppis
The basic randomisation algorithm is:

take a new array
for each element in the old array: add it at a random position in the new array

It's not really rocket science, but it should do the job perfectly well for your purposes.

Danny
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to