Not random, but it does it's thing. 14000 / 7 = 2000 ms each image.
local images = math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), 1)
getTickCount() % 14000
This gives you a value between 0 and 13999 in milliseconds. This value counts up, resets and counts up again.
(getTickCount() % 14000) / 14000)
Value between 0 and 0.999999999.
7 * ((getTickCount() % 14000) / 14000)
Value between 0 and 6.9999999
math.ceil(7 * ((getTickCount() % 14000) / 14000))
Value between 0 and 7. (very small chance that the value is 0)
math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), 1)
Value between 1 and 7.