Assuming that all image URL's are stored in "images.txt" (one URL per line), the code will be as simple as this:
Code:
$images = file('images.txt');
shuffle($images);
for ($i = 0; $i < min(5, count($images)); $i++) {
echo '<img src="' . trim($images[$i]) . '" />';
}