here is one I use. It is based from time so no two file names can be the same. It is an out put of 32 characters but you can shorten it.
$The_File = "yourfilename.gif";
function my_file_name($TheFile){
$new_file_name = md5($The_File . time());
}
and to shorten it
$new_file_name = substr(md5($The_File . time()),0,15);
or to keep a few letter of the original file name etc.
$new_file_name = substr($The_File,0,5) . substr(md5($The_File . time()),0,15);
The important part is the time(); this is the same thing as date("U");