Move rand functions from util to new random.h/.cpp
[novacoin.git] / src / addrman.cpp
index a754926..6c3f394 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "addrman.h"
 #include "hash.h"
+#include "random.h"
 #include "streams.h"
 
 using namespace std;
@@ -538,3 +539,13 @@ void CAddrMan::Connected_(const CService &addr, int64_t nTime)
     if (nTime - info.nTime > nUpdateInterval)
         info.nTime = nTime;
 }
+
+CAddrMan::CAddrMan() : vRandom(0), vvTried(ADDRMAN_TRIED_BUCKET_COUNT, std::vector<int>(0)), vvNew(ADDRMAN_NEW_BUCKET_COUNT, std::set<int>())
+{
+    nKey.resize(32);
+    GetRandBytes(&nKey[0], 32);
+
+    nIdCount = 0;
+    nTried = 0;
+    nNew = 0;
+}