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

#!/bin/bash
# get images
files=(/nas/download/share/fun/images/wallpapers/*.png)
# find out random one
n=${#files[@]}
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"