you could use a random number gen, and simply use filenames for your images which include those numbers (ie img_1.gif, img_2.gif etc) then wherever you want the random image, just go:
images/img_<%=randomnumber%>.gif
obviously it requires all images to be the same file type, and it would require you to change the code whenever you changed the number of images in the folder and the above code undoubtedly use incorrect syntax, but you get my drift? whether thats just being overly creative for what might be a relatively simple problem i have no idea, but its a thought.