a) Best done on the server side so that users with JS disabled can enjoy that functionality.
b) STFW (or to put it mildly GIYF)
c) I feel altruistic today
Code:
...
<script type="text/javascript">
photos = ['photo1.jpg','photo2.jpg','photo3.jpg'];
function replacePhoto()
{ document.getElementById('randomImage').src = photos[Math.floor(.99*Math.random()*photos.length)];
}
</script>
</head>
<body onload="replacePhoto()">
...
<img id="randomImage" alt="My image" src="photo0.jpg" />
...