We've had a
random number generation script
on the site
for a while, but I continue to get questions about how to
show a random image so here you go.
As I started writing this, I realized there are a number of
ways to tackle the problem and the one you choose probably
has a lot to do with your particular situation and requirements.
So I decided that instead of just displaying a random image, I'd
do it three different ways and display three of them in an effort
to illustrate some different
approaches. They all rely upon the random number generator to
pick an image, but how that number is translated to a file
name indicating which image to show varies quite a bit from one method to the next.
Oh and if you're wondering where I got the images, they're
from the website
of the most recent addition to my development toolbox.
They probably won't make you a better programmer, but they might
just help you meet that deadline your boss just sprung on you!