private int findRandomPort(int minPort, int maxPort) {
            int portRange = maxPort - minPort;
            return minPort + random.nextInt(portRange + 1);
        }
Find a pseudo-random port number within the range [{@code minPort}, {@code maxPort}].

@param minPort the minimum port number
@param maxPort the maximum port number
@return a random port number within the specified range
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/SocketUtils.java