Open /home/username , look for .profile file.
Append the following line to it:
gsettings set org.mate.background picture-filename `ls /home/username/Pictures/Wallpapers/*.jpg | shuf -n1`
(this is a one liner, no line breaks here. i just suck at html)
Replace /home/username/Pictures/Wallpapers with the wallpapers directory.
For GNOME desktop environment:
replace org.mate.background picture-filename
with org.gnome.desktop.background picture-uri
(I've never tried this myself though)