Random image & Link

Hello again,

I have a random image appearing on my homepage everytime you visit it,

I want to be able to assign a link to that particular random image so that the user (when the see an image they like) can click on it and it will take them to an adequate place.

I am using php for the random image.

Any suggestions, here is the btw,