code: func (b *Backoff) ForAttempt(attempt float64) time.Duration {
  	// Zero-values are nonsensical, so we use
  	// them to apply defaults
  	min := b.Min
  	if min <= 0 {
  		min = 100 * time.Millisecond
  	}
  	max := b.Max
  	if max <= 0 {
  		max = 10 * time.Second
  	}
  	if min >= max {
  		// short-circuit
  		return max
  	}
  	factor := b.Factor
  	if factor <= 0 {
  		factor = 2
  	}
  	//calculate this duration
  	minf := float64(min)
  	durf := minf * math.Pow(factor, attempt)
  	if b.Jitter {
  		durf = rand.Float64()*(durf-minf) + minf
  	}
  	//ensure float64 wont overflow int64
  	if durf > maxInt64 {
  		return max
  	}
  	dur := time.Duration(durf)
  	//keep within bounds
  	if dur < min {
  		return min
  	}
  	if dur > max {
  		return max
  	}
  	return dur
  }
docs: // ForAttempt returns the duration for a specific attempt. This is useful if
  // you have a large number of independent Backoffs, but don't want use
  // unnecessary memory storing the Backoff parameters per Backoff. The first
  // attempt should be 0.
  //
  // ForAttempt is concurrent-safe.