<?php$dir = "/some/dir";$url = "http://some/url";$x=explode("\n",cd $dir; ls *.jpg *.png *.gif);header("Status: 302 Found\n");header("Location: $url/" . $x[array_rand($x)]);?>
Not how I would normally do it, but hey, no loops.