Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lthibault/jitterbug
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed May 20, 2019
2 parents d079099 + a0df38e commit 237c91a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion norm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion univariate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

0 comments on commit 237c91a

Please sign in to comment.