Skip to content

Commit

Permalink
Fix uniform_int_distribution C++11 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvr committed Dec 5, 2024
1 parent 5328bfd commit 1396109
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/weighted_matching_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ void run_random_graph(unsigned int n, unsigned int m, std::mt19937& rng)
{
while (true)
{
unsigned int x = std::uniform_int_distribution(0U, n - 2)(rng);
unsigned int y = std::uniform_int_distribution(x + 1, n - 1)(rng);
std::uniform_int_distribution<unsigned int> xdist{0, n - 2};
unsigned int x = xdist(rng);
std::uniform_int_distribution<unsigned int> ydist{x + 1, n - 1};
unsigned int y = ydist(rng);
bool ok = true;
for (const auto& e : edges_info)
{
Expand All @@ -260,7 +262,8 @@ void run_random_graph(unsigned int n, unsigned int m, std::mt19937& rng)
}
if (ok)
{
long w = std::uniform_int_distribution(0, 1000)(rng);
std::uniform_int_distribution<long> wdist{0, 1000};
long w = wdist(rng);
edges_info.push_back(edge_info<long>{x, y, w});
break;
}
Expand Down

0 comments on commit 1396109

Please sign in to comment.