if the ads are in a seperate folder, you can read the folder contents into an array and use the pre-defined random variable to select a number between 0 and count($array). Otherwise, you can make an entry in a text file or database that points to each add page, read that into an array, etc etc.
hope that helps.