In another example how to generate a random number, here is a application

Here is a short example to show you how to create a random wallpaper

Note: you need to put this script to cron

# get images
# find out random one
wallpaper="${files[RANDOM % n]}"
# Kde3 command (may not work with kde4)
# dcop kdesktop KBackgroundIface setWallpaper "$wallpaper" 5
# Gnome command
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$wallpaper"