This module includes a function you can call to randomly pick an image from a directory. For an example see
http://webstersprodigy.net/pages/randompicture.php. It is based on a module written by John Maats, and I just added the captioning. Pretty trivial...
The module description: This snippet shows a random image from directory - RandomImage(directoryname to show images from) also optionally includes captions in the directory - example.jpg will automatically display example.txt if it exists.