this is almost like a database issue.
Suggest you call session_start(); at the top of pages that use this.
then save your files as this:
$name[1]="img_".$PHPSESSID."_".1.".png";
//in case they need multiple images
$name[2]="img_".$PHPSESSID."_".2.".png";
Now, regarding the CRON job, I'd suggest no. Put all these images in a single folder, and assuming this feature that creates random images is the only feature that accesses this folder, then also have it manage deletions. i.e. every time an image is created, delete all images in the folder that are n minutes before the current time. Change n based on the usage level of the feature.
By the way do you write CRON? PM me with your email, I may need your help sometime!! :-)
HTH,
Sam Fullman
Compass Point Media