static getValidIPv4(ip) {
    const match =
      !ip ||
      ip.match(
        /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[1-2][0-9]|3[0-2]))?$/,
      )
    if (match) {
      if (match[5]) {
        const mask = parseInt(match[5], 10)
        let [a, b, c, d] = ip.split('.').map((x) => parseInt(x, 10))
        // eslint-disable-next-line no-bitwise
        const max = (1 << (32 - mask)) - 1
        const rand = Math.floor(Math.random() * max)
        d += rand
        c += Math.floor(d / 256)
        d %= 256
        b += Math.floor(c / 256)
        c %= 256
        a += Math.floor(b / 256)
        b %= 256
        return `${a}.${b}.${c}.${d}`
      }
      return ip
    }
    return undefined
  }
Get a valid IPv4 address string from input IP.
@param {string} ip - A fixed IPv4 address or a range of IPv4 using CIDR notation.
@returns {string} A valid IPv4 address or undefined.
                  If 'ip' is a valid fixed IPv4 address, it returns 'ip' itself.
                  If 'ip' is a range of IPv4 using CIDR notation, it returns a random address within the range.
                  Otherwise, it returns undefined.