From: Yann Duplouy Date: Mon, 21 Oct 2019 09:18:37 +0000 (+0200) Subject: The dht-chord example now uses the new module X-Git-Tag: v3.25~386^2~12 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c6df91ec1d59a1c459e0e36d3fda0bad108fc1b0 The dht-chord example now uses the new module --- diff --git a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp index 8d9640f064..f76484cc29 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp +++ b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp @@ -134,9 +134,7 @@ void Node::notifyAndQuit() void Node::randomLookup() { int res = id_; - // std::uniform_int_distribution dist(0, nb_bits - 1); - // int random_index = dist(generator); - int random_index = generator() % nb_bits; // ensure reproducibility across platforms + int random_index = simgrid::xbt::random::uniform_int(0, nb_bits - 1); int random_id = fingers_[random_index]; XBT_DEBUG("Making a lookup request for id %d", random_id); if (random_id != id_) diff --git a/examples/s4u/dht-chord/s4u-dht-chord.cpp b/examples/s4u/dht-chord/s4u-dht-chord.cpp index b8d20a71df..372c509bf6 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord.cpp +++ b/examples/s4u/dht-chord/s4u-dht-chord.cpp @@ -11,8 +11,6 @@ int nb_bits = 24; int nb_keys = 0; int timeout = 50; -std::mt19937 generator; - int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); diff --git a/examples/s4u/dht-chord/s4u-dht-chord.hpp b/examples/s4u/dht-chord/s4u-dht-chord.hpp index 81821cf8a3..eea1f2f41a 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u-dht-chord.hpp @@ -6,8 +6,8 @@ #ifndef S4U_CHORD_HPP #define S4U_CHORD_HPP #include "simgrid/s4u.hpp" -#include #include +#include #include constexpr double MAX_SIMULATION_TIME = 1000; @@ -21,8 +21,6 @@ extern int nb_bits; extern int nb_keys; extern int timeout; -extern std::mt19937 generator; - /* Types of tasks exchanged between nodes. */ enum e_message_type_t { FIND_SUCCESSOR,