lib/util: Should seed random number generator on startup

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3063
This commit is contained in:
Jakob Borg 2016-05-09 09:36:42 +00:00 committed by Audrius Butkevicius
parent bd41e21c26
commit 3ad42d9279

View File

@ -17,6 +17,11 @@ import (
// randomCharset contains the characters that can make up a randomString().
const randomCharset = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
func init() {
// The default RNG should be seeded with something good.
mathRand.Seed(RandomInt64())
}
// RandomString returns a string of random characters (taken from
// randomCharset) of the specified length.
func RandomString(l int) string {