file() let's you read a text into an array, putting each new line into a cell in the array.
rand() lets you pick random numbers.
srand() seeds the random-number generator, to make sure you get random numbers.
$aLines = file("filename");
echo "There are ".count($aLines)." lines in this file<BR>\n";
srand ((double) microtime() * 1000000);
$randval = rand(0,count($aLines));
echo $aLines($randval);