Just change the directory to what you want, it's set to http://www.yoursite.com/images/ right now, so change to what you want.
Demo version: http://left4quake.com/test.php
$dir = "./images/";
$dh = opendir($dir);
$a = array();
while ($filename = readdir($dh)) { $filename = $dir.$filename; if (getimagesize($filename)) { $a[]="$filename"; } }
$rand = array_rand($a, 1);
echo "<img src='$a[$rand]' style='max-width:100%;' />";