Should be...
var idx = Math.floor(Math.random() * images.length);
... as at the moment you for some reason multiply the result by 10, having quite a low chance for the final result to be either 0 or 1.
Note that Math.random() doesn't take any arguments: it always generates a number in [0, 1)
range.