iki satırı birleştirip böyle dener misin
var ran=Math.floor((Math.random()*30)+1);
buradaki 30 image.length