Encontrei neste site como selecionar aleatoriamente as linhas de um txt com os links de anúncios escolhidos previamente:
$filename = $_SERVER["DOCUMENT_ROOT"].‘/inc/pub/pub_array.txt’;
$how_many_to_show = 7;
if ($fileContents = file($filename)) {
shuffle($fileContents);
for ($i = 0; $i < $how_many_to_show; $i++) { echo $fileContents[$i]; }
}
else { die(‘Could not get contents of: ‘.$filename); }

