WIP
[awesomized/libmemcached] / test / lib / random.cpp
index 6aab887597f087e75b823f24773cf0515845c11d..76c049710432ffbc4b0be42d43aaee59a265c370 100644 (file)
@@ -1,7 +1,18 @@
 #include "test/lib/random.hpp"
 #include "test/lib/Connection.hpp"
 
-#include <unistd.h> // getpid()
+#if HAVE_UNISTD_H
+#  include <unistd.h> // getpid()
+#endif
+mt19937_64 rnd_eng;
+mutex rnd_mtx;
+
+void random_setup() {
+  using namespace chrono;
+
+  auto time = duration_cast<nanoseconds>(system_clock::now().time_since_epoch());
+  rnd_eng.seed(static_cast<mt19937_64::result_type>(time.count()));
+}
 
 unsigned random_port() {
   do {