Commit 6c3d1149 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: make use of uniform_sample()

parent 95e1e194
Pipeline #165 failed with stage
...@@ -1207,9 +1207,7 @@ public: ...@@ -1207,9 +1207,7 @@ public:
template <class Edge, class RNG> template <class Edge, class RNG>
const auto& sample_edge(const vector<Edge>& elist, RNG& rng) const auto& sample_edge(const vector<Edge>& elist, RNG& rng)
{ {
std::uniform_int_distribution<size_t> urand(0, elist.size() - 1); return get<0>(uniform_sample(elist, rng));
size_t ur = urand(rng);
return get<0>(elist[ur]);
} }
template <class Vertex, class RNG> template <class Vertex, class RNG>
...@@ -1296,8 +1294,7 @@ auto sample_neighbour(Sampler& sampler, RNG& rng) ...@@ -1296,8 +1294,7 @@ auto sample_neighbour(Sampler& sampler, RNG& rng)
template <class Vertex, class RNG> template <class Vertex, class RNG>
auto sample_neighbour(vector<Vertex>& sampler, RNG& rng) auto sample_neighbour(vector<Vertex>& sampler, RNG& rng)
{ {
std::uniform_int_distribution<Vertex> rand(0, sampler.size() - 1); return uniform_sample(sampler, rng);
return sampler[rand(rng)];
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment