Here's a javascript solution I've used on one of my sites. It uses MooTools - so you need to load that library first.
// Arrange random artwork - MooTools must already be loaded
baseUrl = "http://some.domain.com/images/random/"; // web URL to the directory containing the images
var choices = [
"image1.png",
"image2.png",
"image3.png",
"image4.png",
"image5.png"
]; // an array containing all the images to be used in the random selection
var artworkLocations = $$('.randomimg'); // this is the class name to apply to the div that will hold the image
$each(artworkLocations, function(value, key){
value.style.backgroundImage = "url("+ baseUrl + choices.getRandom()+")";
});
And the HTML:
<div class="randomimg"></div>