Skip to content

Commit

Permalink
chore: change deprecated rand
Browse files Browse the repository at this point in the history
  • Loading branch information
bxcodec committed Jun 9, 2024
1 parent 9e219dc commit d1640c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d1640c7

Please sign in to comment.