How do you want this to work:
- Give it a directory and it picks a random image from that directory?
- Store images paths in a database and pick one randomly?
- Store images paths in a text file and pick one randomly?
- Does the image have to have any meta-data associated with it (alt text, size, supplier reference etc)?
You realise that if you have,say , 4 images to choose from "randomly" then you could conceivably return the same image 2 or more times in succession.
Is that what you mean exactly, or do you mean "in turn", if you do mean "in turn" how do you decide which is the first one? If your webpage has 1000 hits and they all get the first image every time, then that wont be very "random" unless the "turn" is rotated.
(one way round this is to number the images and then serve them by day of week, sunday you serve up 0.jpg, monday, 1.jpg and so on. Use the same trick to serve by the hour, or by the minute, or by the last digit of the timestamp (i.e. of 10) ... and so on.
Do any of these links give you ideas
random banner generator PHP
, come back and try and explain a little bit more about your particular situation and let us know what you tried and what did and did not work.