I'm trying to make a gallery with about 20 images that are randomly selected from the folder images/random. This is the code I've come up with so far, the problem is that it shows the same image all over the gallery. Any help would be much appreciated.
var array = ['1.jpg', ..., 100.jpg ]
var path = "images/random"
var index = Math.floor(Math.random() * (array.length)),
image = array[index];
$(".random").attr("src", path + image);
HTML
<img class="random" src="" alt="">