From fa791b7e96c781e05817bf5321edc26359b3a4dc Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 6 Nov 2022 15:30:56 +0200 Subject: [PATCH] init pseudorandom seed --- tools/security/random.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/security/random.go b/tools/security/random.go index e656655a..9265e94d 100644 --- a/tools/security/random.go +++ b/tools/security/random.go @@ -4,10 +4,15 @@ import ( cryptoRand "crypto/rand" "math/big" mathRand "math/rand" + "time" ) const defaultRandomAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" +func init() { + mathRand.Seed(time.Now().UnixNano()) +} + // RandomString generates a cryptographically random string with the specified length. // // The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding.