From 547f601d7899cb59e63f0fa721054238b0dc8ad8 Mon Sep 17 00:00:00 2001 From: a-ok123 <54385956+a-ok123@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:11:03 -0400 Subject: [PATCH] fix for revive --- common/utils/utils.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/utils/utils.go b/common/utils/utils.go index 085bf44..26549aa 100644 --- a/common/utils/utils.go +++ b/common/utils/utils.go @@ -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 }