public int getPaintImageIndex(int[][] currentBlockArray, BufferedImage[] images, int x, int z, int xMin, int xMax, boolean bottomLevel) {
        int[][] pixels = null;
        int i = -1;
        int fit = 0;
        int count = 0;
        do {
            i = Rand.getRange(0, images.length-1);
            pixels = getImagePixels(images[i]);
            fit = paintImageFit(currentBlockArray, pixels, x, z, xMin, xMax, bottomLevel);
            count++;
        } while(fit < 1 && count <= images.length);
        if(fit == 2 && noExitImages.size() < 1 || count > images.length) {
            i = -1;
        }
        //System.out.println("index: "+i+" fit: "+fit);
        return i;
    }