Shuffle an Array

http://stackoverflow.com/questions/14970556/how-do-i-randomize-the-order-of-the-images/22187089#22187089

by Prateek Kathal

HTML

<div id="lighttable">

<img id="girl1" src="" alt="01" />
<img id="girl2" src="" alt="02" />
<img id="girl3" src="" alt="03" />

etc....

</div>

JavaScript

var array = ['http://throwingupthew.com/girls/01.jpg','http://throwingupthew.com/girls/02.jpg','http://throwingupthew.com/girls/03.jpg'];
    function shuffle(array) {
    var currentIndex = array.length;
    var temporaryValue;
    var randomIndex;
      while (0 !== currentIndex) {
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
      }
      return array;
    }
    var shuffled_images = shuffle(array);
    for(var i=0;i<3;i++) {
    document.getElementById('girl' + (i+1)).src = shuffled_images[i] ;
    }