From ef75ece7826242b192ca96b9d74b611408ad7e41 Mon Sep 17 00:00:00 2001 From: Kilian Verhetsel <kilian.verhetsel@student.uclouvain.be> Date: Sun, 11 Dec 2016 18:24:04 +0000 Subject: [PATCH] Changed LNS fragment selector to no longer use #include <random> --- Mesh/mwis.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Mesh/mwis.hpp b/Mesh/mwis.hpp index 68d0b7ca25..bee2947900 100644 --- a/Mesh/mwis.hpp +++ b/Mesh/mwis.hpp @@ -8,7 +8,6 @@ #include <boost/graph/graph_concepts.hpp> #include <boost/graph/adjacency_list.hpp> -#include <random> #include <vector> #include <functional> #include <limits> @@ -891,12 +890,11 @@ lns_fragment<Graph> fragment_selector(const lns_state<Graph, WeightMap> &state) if (boost::num_vertices(state.graph) == 0) return lns_fragment<Graph>(std::set<vertex>()); - std::random_device dev; - std::mt19937 gen(dev()); + std::pair<vertex_iterator, vertex_iterator> vs = vertices(state.graph); - vertex v = boost::random_vertex(state.graph, gen); + vertex v = *(vs.first + (rand() % std::distance(vs.first, vs.second))); - size_t neighborhood_size = std::uniform_int_distribution<size_t>(50, 80)(gen); + size_t neighborhood_size = 30 + rand() % 30; std::set<vertex> set; set.insert(v); -- GitLab