mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
remove deprecated math/rand.Seed calls
see https://pkg.go.dev/math/rand#Seed
This commit is contained in:
committed by
Dan Christian Bogos
parent
0aa5cf38e8
commit
df7b65833a
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user