in reply to RE: Sample Random (Code)
in thread Reading files sequentially

This is a case where I think it would be a good fit to use JavaScript to choose the locations of the images. Really this is a question that fits well on the client-side.

Alternately have the html have the tags filled in through some sort of CGI/mod_perl/server side include.

Trying to have a CGI program which is not aware of what else is on the target page try to fill it in is going to break in time. (What happens if you have 3 webservers? How about if you have requests coming from 2 people at once?)