its simple using php.
use rand() function to get a value.
check for random value against your desired number or range.
redirect if it meets the requirement.

edit:
you can use htaccess rewrite rule
like RewriteRule ^/img.jpg ./random.php
deAthbLisS Reviewed by deAthbLisS on . .htaccess - rotate image url? Is it possable to use .htaccess to rotate image using the same URL? For exmaple: domain.com/random.jpg Redirect to randomly: domain.com/image1.jpg domain.com/image2.jpg Rating: 5