You will need to write a plugin to read the php script and then put the random line into a variable. Then preregister the variable for use in that specific template. And then put the variable into the template.
This exact thing has actually been covered quite a few times if you try a search.
I did try search, I'm not even sure what Is should search after.