Your code
Added id="img1"
<img id="img1" src="?option=com_fcse&task=getimage&width=100&height=40&characters=5&r=<?php echo mt_rand(0, 10000000); ?>" />
JS Code:
var newImage = new Image(); newImage.src = document.getElementById("img1").src + "&_=" + new Date().getTime();
Added cache breakout at end of url
source share