mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 02:53:50 +00:00
12 lines
216 B
Go
12 lines
216 B
Go
package util
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
func MillisecondsJitter(d time.Duration, jitterInMilliseconds int) time.Duration {
|
|
n := rand.Intn(jitterInMilliseconds)
|
|
return d + time.Duration(n)*time.Millisecond
|
|
}
|