code: func calculateRandomExpiry(validFrom, validUntil time.Time) time.Duration {
  	duration := validUntil.Sub(validFrom)
  
  	var randomExpiry int
  	// Our lower bound of renewal will be half of the total expiration time
  	minValidity := int(duration.Minutes() * CertLowerRotationRange)
  	// Our upper bound of renewal will be 80% of the total expiration time
  	maxValidity := int(duration.Minutes() * CertUpperRotationRange)
  	// Let's select a random number of minutes between min and max, and set our retry for that
  	// Using randomly selected rotation allows us to avoid certificate thundering herds.
  	if maxValidity-minValidity < 1 {
  		randomExpiry = minValidity
  	} else {
  		randomExpiry = rand.Intn(maxValidity-minValidity) + minValidity
  	}
  
  	expiry := time.Until(validFrom.Add(time.Duration(randomExpiry) * time.Minute))
  	if expiry < 0 {
  		return 0
  	}
  	return expiry
  }
docs: // calculateRandomExpiry returns a random duration between 50% and 80% of the
  // original validity period