Since random images is the smallest bottleneck of the script (aka it has most impact on the site's performance), 4images caches random images for each category that improves performance if more then one random image needed, that's why it doesn't matter how many times you tried get a random image for the same category (on same page) it will be the same. Other words, any changes to this will degrease your site performance.
In details.php (and/or in categories.php) find:
$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image($cat_id);
Insert below:if (!defined("SHOW_RANDOM_IMAGE") || SHOW_RANDOM_IMAGE != 0)
{
$random_image_cache = get_random_image_cache();
$random_cat_image2 = get_random_image($cat_id);
$site_template->register_vars("random_cat_image2", $random_cat_image2);
}
Use {random_cat_image2} tag