remove deprecated math/rand.Seed calls

see https://pkg.go.dev/math/rand#Seed
This commit is contained in:
ionutboangiu
2024-09-05 18:27:25 +03:00
committed by Dan Christian Bogos
parent 0aa5cf38e8
commit df7b65833a
6 changed files with 0 additions and 12 deletions

View File

@@ -86,10 +86,6 @@ var (
}
)
func init() {
rand.Seed(time.Now().UnixNano()) // used in benchmarks
}
// Test start here
func TestSTSV1IT(t *testing.T) {
switch *utils.DBType {

View File

@@ -30,10 +30,6 @@ import (
"github.com/cgrates/cgrates/utils"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
// ResourceProfile represents the user configuration for the resource
type ResourceProfile struct {
Tenant string

View File

@@ -180,7 +180,6 @@ func (rbcs *RandomBalancesSorter) Sort() {
src := *rbcs
// randomize balance chain
dest := make([]*Balance, len(src))
rand.Seed(time.Now().UnixNano())
perm := rand.Perm(len(src))
for i, v := range perm {
dest[v] = src[i]

View File

@@ -76,7 +76,6 @@ func getSessionTTL(ev *engine.MapEvent, cfgSessionTTL time.Duration,
}
sessionTTLMaxDelay = maxDelay.Nanoseconds() / 1000000 // Milliseconds precision for randomness
if sessionTTLMaxDelay != 0 {
rand.Seed(time.Now().Unix())
ttl += time.Duration(rand.Int63n(sessionTTLMaxDelay) * 1000000)
}
return

View File

@@ -247,7 +247,6 @@ func (sS *SessionS) setSTerminator(s *Session) {
}
}
if maxDelay != 0 {
rand.Seed(time.Now().Unix())
ttl += time.Duration(
rand.Int63n(maxDelay.Nanoseconds()/time.Millisecond.Nanoseconds()) * time.Millisecond.Nanoseconds())
}

View File

@@ -64,7 +64,6 @@ var (
func init() {
startCGRateSTime = time.Now()
math_rand.Seed(startCGRateSTime.UnixNano())
}
// GetStartTime return the Start time of engine (in UNIX format)