1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-03-18 05:37:49 +02:00

init pseudorandom seed

This commit is contained in:
Gani Georgiev 2022-11-06 15:30:56 +02:00
parent 0ff5606d80
commit fa791b7e96

View File

@ -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.