private int[][] matrix(int n, Random random) {
        int[][] result = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                result[i][j] = random.nextInt();
            }
        }
        return result;
    }