code: func BackoffNanos(
  	retry int,
  	jitter bool,
  	backoffFactor float64,
  	initialBackoff time.Duration,
  	maxBackoff time.Duration,
  	rngFn RngFn,
  ) int64 {
  	backoff := initialBackoff.Nanoseconds()
  	if retry >= 1 {
  		backoffFloat64 := float64(backoff) * math.Pow(backoffFactor, float64(retry-1))
  		// math.Inf is also larger than math.MaxInt64.
  		if backoffFloat64 > math.MaxInt64 {
  			return maxBackoff.Nanoseconds()
  		}
  		backoff = int64(backoffFloat64)
  	}
  	// Validate the value of backoff to make sure Int63n() does not panic.
  	if jitter && backoff >= 2 {
  		half := backoff / 2
  		backoff = half + rngFn(half)
  	}
  	if maxBackoff := maxBackoff.Nanoseconds(); backoff > maxBackoff {
  		backoff = maxBackoff
  	}
  	return backoff
  }
docs: // BackoffNanos calculates the backoff for a retry in nanoseconds.