Just go here, hit "View Source" and copy the script I found
Edit: Forgot

Dodgy Php...
Here's the code, just put this on your site and stick the images in a subfolder called "img", that all! To add more just put stick more images in the 'img' directory.
code:
<?php
/*
Based on code by Perpetual Dreamer and Alland.
Instructions:
Place all the files that you want into the directory of your choice,
which will be specified in the $path variable.
Then, just link to the script as a php file. Can be used in a site, such as <img src="filename.php">,
or a forum, using [img ]http://yoursite.com/filename.php[/img]
Enjoy.
Rob
*/
//directory here (relative to script)
$path = 'img';
$i = 0;
$imgDir = opendir ($path);
while ( $file = readdir( $imgDir ) )
{
//checks that file is an image
$file_type = strrchr( $file, "." );
$is_image = eregi( "jpg|gif",$file_type );
if ( $file != '.' && $file != '..' && $is_image )
{ $images[$i++] = $file; }
}
closedir ($imgDir);
srand( (double) microtime()*1000000 );
$image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )];
$imgSize = GetImageSize( $image_name );
//ends script if no images found
if ( $i == 0 )
die();
//Display the image
readfile("$image_name");
?>