Better code for random image setter