Implementation of glass filter for images
Interesting exercise and nice implementation, few suggestions on my side:

The method chooseRandomNeighbor is only used by filter, so it can be set to private
The name filter is too general for a method, a better name might be applyGlassFilter
In Java the name of a class starts with a capital letter

Optimization

random neighboring pixel (whose pixel coordinates both differ from p’s
coordinates by at most 5).

The method chooseRandomNeighbor picks an adjacent random neighbor (which differ by at most 1) and then gets called 4 times. That implies creating 4 full images in memory. Wouldn't be better to directly pick a neighbor with maximum distance 5?
To do that the method chooseRandomNeighbor needs to accept the width or height:
int neighborColIndex = chooseRandomNeighbor(col,width);
int neighborRowIndex = chooseRandomNeighbor(row,height);

And this is chooseRandomNeighbor refactored:
private static int chooseRandomNeighbor(int index, int max) {
    // Random delta between -5 and +5
    int randomDelta = (int) ((Math.random() * (10)) - 5);
    // Add delta to index without overflowing the limit
    int neighborIndex = (index + randomDelta) % max;
    // If index is negative return 0
    return neighborIndex &lt; 0 ? 0 : neighborIndex;
}

Now the method filter can be called only once and only the new image will be created in memory.
Side note: you are getting better and better, keep up the good work!
Code Refactored
public class Test {
    
    public static Picture applyGlassFilter(Picture inputPicture) {
        int width = inputPicture.width();
        int height = inputPicture.height();
        Picture outputPicture = new Picture(width, height);
        for (int col = 0; col &lt; width; col++) {
            for (int row = 0; row &lt; height; row++) {
                int neighborColIndex = chooseRandomNeighbor(col,width);
                int neighborRowIndex = chooseRandomNeighbor(row,height);
                Color c = inputPicture.get(neighborColIndex,neighborRowIndex);
                outputPicture.set(col, row, c);
            }
        }
        return outputPicture;
    }
    
    private static int chooseRandomNeighbor(int index, int max) {
        // Random delta between -5 and +5
        int randomDelta = (int) ((Math.random() * (10)) - 5);
        // Add delta to index without overflowing the limit
        int neighborIndex = (index + randomDelta) % max;
        // If index is negative return 0
        return neighborIndex &lt; 0 ? 0 : neighborIndex;
    }
    
    public static void main(String[] args) {
        Picture inputPicture = new Picture(args[0]);
        Picture outputPicture = applyGlassFilter(inputPicture);
        outputPicture.show();
    }
}