Here's a very clean, fast and simple way to randomize an array.

array.sort(randomizeFunction);

function randomize(a:int, b:int):int
{
    return int(Math.random() * 2) - 1;
}

If you're not happy with Math.random()'s randomness, there are plenty of other random number generators out there, such as:

http://lab.polygonal.de/2007/04/21/a-good-pseudo-random-number-generator-prng/

And Grant Skinner's Rndm:
http://www.gskinner.com/blog/archives/2008/01/source_code_see.html
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to