@@ -21,7 +21,7 @@ import (
2121 "github.com/michaelquigley/pfxlog"
2222 cmap "github.com/orcaman/concurrent-map/v2"
2323 errors "github.com/pkg/errors"
24- "golang.org/x/exp/ rand"
24+ "math/ rand/v2 "
2525 "net"
2626 "net/url"
2727 "sync/atomic"
@@ -223,7 +223,6 @@ func (c *ClientTransportPoolRandom) TryTransportForF(cb func(*ApiClientTransport
223223}
224224
225225func (c * ClientTransportPoolRandom ) AnyTransport () * ApiClientTransport {
226- rand .Seed (uint64 (time .Now ().UnixNano ()))
227226 transportBuffer := c .pool .Items ()
228227 var keys []string
229228
@@ -234,7 +233,9 @@ func (c *ClientTransportPoolRandom) AnyTransport() *ApiClientTransport {
234233 if len (keys ) == 0 {
235234 return nil
236235 }
237- index := rand .Intn (len (keys ))
236+ seed := uint64 (time .Now ().UnixNano ())
237+ rng := rand .New (rand .NewPCG (seed , seed ))
238+ index := rng .IntN (len (keys ))
238239 return transportBuffer [keys [index ]]
239240}
240241
@@ -257,11 +258,12 @@ func errorIndicatesControllerSwap(err error) bool {
257258}
258259
259260func selectAndRemoveRandom [T any ](slice []T , zero T ) (selected T , modifiedSlice []T ) {
260- rand .Seed (uint64 (time .Now ().UnixNano ()))
261261 if len (slice ) == 0 {
262262 return zero , slice
263263 }
264- index := rand .Intn (len (slice ))
264+ seed := uint64 (time .Now ().UnixNano ())
265+ rng := rand .New (rand .NewPCG (seed , seed ))
266+ index := rng .IntN (len (slice ))
265267 selected = slice [index ]
266268 modifiedSlice = append (slice [:index ], slice [index + 1 :]... )
267269 return selected , modifiedSlice
0 commit comments