diff --git a/README.md b/README.md index 8661a7f..5f7bedc 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,11 @@ t := jitterbug.New( ) ``` +## Compatible libraries + +- [GoNum](https://github.com/gonum/gonum), specifically the [univariate distributions](https://godoc.org/gonum.org/v1/gonum/stat/distuv). +- [Suture](https://github.com/thejerf/suture) can use jitterbug for it's backoff [durations](https://godoc.org/github.com/thejerf/suture#Jitter). + ## RFC If you find this useful please let me know: diff --git a/norm.go b/norm.go index 3371922..7ba6ad7 100644 --- a/norm.go +++ b/norm.go @@ -19,5 +19,5 @@ func (n Norm) Jitter(d time.Duration) time.Duration { } samp := f()*float64(n.Stdev) + float64(n.Mean) - return d * time.Duration(samp) + return d + time.Duration(samp) } diff --git a/univariate.go b/univariate.go index ea1ffa4..dc7fdcf 100644 --- a/univariate.go +++ b/univariate.go @@ -16,5 +16,5 @@ type Univariate struct { // Jitter the duration by drawing from a univariate distribution func (u Univariate) Jitter(d time.Duration) time.Duration { - return d * time.Duration(u.Rand()) + return d + time.Duration(u.Rand()) }