// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
-#include <mutex>
-#include <random>
-
#include <netdb.h>
#include "include/types.h"
+#include "include/random.h"
+
#include "Messenger.h"
#include "msg/simple/SimpleMessenger.h"
{
int r = -1;
if (type == "random") {
- static std::random_device seed;
- static std::default_random_engine random_engine(seed());
-
- static std::mutex random_lock;
- std::lock_guard<std::mutex> lock(random_lock);
-
- std::uniform_int_distribution<> dis(0, 1);
- r = dis(random_engine);
+ r = ceph::util::generate_random_number(0, 1);
}
if (r == 0 || type == "simple")
return new SimpleMessenger(cct, name, std::move(lname), nonce);