From d1640c7af93ae304b2c2d837d5ba317e837eaf63 Mon Sep 17 00:00:00 2001 From: Iman Tumorang Date: Sun, 9 Jun 2024 23:03:04 +0300 Subject: [PATCH] chore: change deprecated rand --- loadbalancer.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loadbalancer.go b/loadbalancer.go index 92744452..b3c9eed3 100644 --- a/loadbalancer.go +++ b/loadbalancer.go @@ -42,10 +42,10 @@ func (lb RandomLoadBalancer[T]) Resolve(dbs []T) T { } func (lb RandomLoadBalancer[T]) predict(n int) int { - rand.Seed(time.Now().UnixNano()) //nolint - max := n - 1 //nolint - min := 0 //nolint - idx := rand.Intn(max-min+1) + min + r := rand.New(rand.NewSource(time.Now().UnixNano())) + max := n - 1 //nolint + min := 0 //nolint + idx := r.Intn(max-min+1) + min lb.randInt <- idx return idx }