diff --git a/config.go b/config.go index d799c5ff..644aaac8 100644 --- a/config.go +++ b/config.go @@ -72,7 +72,7 @@ func (s *FullJitterStrategy) Calculate(attempt int) time.Duration { backoffDuration := s.cfg.BackoffMultiplier * time.Duration(math.Pow(2, float64(attempt))) - return time.Duration(s.rng.Intn(int(backoffDuration))) + return time.Duration(s.rng.Int63n(int64(backoffDuration))) } func (s *FullJitterStrategy) setConfig(cfg *Config) { diff --git a/config_test.go b/config_test.go index 060b0739..791c2c23 100644 --- a/config_test.go +++ b/config_test.go @@ -80,8 +80,8 @@ func TestExponentialBackoff(t *testing.T) { func TestFullJitterBackoff(t *testing.T) { expected := []time.Duration{ - 566028617 * time.Nanosecond, - 1365407263 * time.Nanosecond, + 724039541 * time.Nanosecond, + 1603903257 * time.Nanosecond, 5232470547 * time.Nanosecond, 21467499218 * time.Nanosecond, }