[Javascript] Random Shuffle of Array

Tim Makins spindrift at oceanfree.net
Thu Jun 12 05:12:18 CDT 2003


var image_array = new Array(72);
// Preload the images into the array
for (var counter = 0; counter < image_array.length; counter++) {

    // Construct the Image object
    image_array[counter] = new Image(60, 60);

    // Build the filename (00.gif through 71.gif)
    image_filename = (counter < 10 ? "0" : "") + counter + ".gif";

    // Assign the filename to the Image object
    image_array[counter].src = image_filename;
}


The code above creates an array and fills it with images. Can anyone point
me to a function that will randomly shuffle the array ?

Tim in Ireland.



More information about the Javascript mailing list