Skip to content

Commit

Permalink
fix for revive
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ok123 committed Sep 23, 2024
1 parent 757fa2f commit 547f601
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,13 @@ func Decompress(data []byte) ([]byte, error) {
}

// RandomDuration returns a random duration between min and max
func RandomDuration(min, max int) time.Duration {
if min > max {
min, max = max, min
func RandomDuration(minVal, maxVal int) time.Duration {
if minVal > maxVal {
minVal, maxVal = maxVal, minVal
}
var n uint64
binary.Read(rand.Reader, binary.LittleEndian, &n) // read a random uint64
randomMillisecond := min + int(n%(uint64(max-min+1)))
randomMillisecond := minVal + int(n%(uint64(maxVal-minVal+1)))
return time.Duration(randomMillisecond) * time.Millisecond
}

Expand Down

0 comments on commit 547f601

Please sign in to comment.