diff --git a/src/common/NebulaUtil.cc b/src/common/NebulaUtil.cc index 5b43e25483..e2880c9da9 100644 --- a/src/common/NebulaUtil.cc +++ b/src/common/NebulaUtil.cc @@ -203,9 +203,16 @@ string * one_util::aes256cbc_encrypt(const string& in, const string password) string one_util::random_password() { + static bool init = false; + ostringstream sstr; - srand(time(0)); + if (!init) + { + srand(time(0) + rand()); + init = true; + } + sstr << rand(); return sha1_digest(sstr.str());