Преглед изворни кода

seed random number generator

Miro Kuratczyk пре 9 година
родитељ
комит
587a7153a4
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      psiphon/server/services.go

+ 3 - 0
psiphon/server/services.go

@@ -24,6 +24,7 @@
 package server
 
 import (
+	"math/rand"
 	"os"
 	"os/signal"
 	"path/filepath"
@@ -42,6 +43,8 @@ import (
 // os.Kill signals are received. The config determines which components are run.
 func RunServices(configJSON []byte) error {
 
+	rand.Seed(int64(time.Now().Nanosecond()))
+
 	config, err := LoadConfig(configJSON)
 	if err != nil {
 		log.WithContextFields(LogFields{"error": err}).Error("load config failed")