How To Make Random Images Appear?

If anyone can help me with this I’d appreciate it.

What I want to know is, how do I make a random image appear on a website whenever someone visits or when the page is reloaded?

Ex: Hotmail uses this to display different ads on the top and sides everytime you go to a new page or refresh the page.

This is what I want to learn. Is there a code or something? I need to be able to do this in Dreamweaver MX. Thanks. :}