diff options
author | Jakob Borg <jakob@nym.se> | 2016-05-09 09:36:42 +0000 |
---|---|---|
committer | Audrius Butkevicius <audrius.butkevicius@gmail.com> | 2016-05-09 09:36:42 +0000 |
commit | 3ad42d9279a49ba6ac5495b0127421f076e654fc (patch) | |
tree | 85e43188f44d3186883935ceeb1b8481be6b2026 | |
parent | bd41e21c26186ca7577f426dab16e99cb71f01cb (diff) |
lib/util: Should seed random number generator on startup
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3063
-rw-r--r-- | lib/util/random.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/util/random.go b/lib/util/random.go index fe77ecf4cc..8b6c485fd7 100644 --- a/lib/util/random.go +++ b/lib/util/random.go @@ -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 { |