Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix % 0 bug in MG_SELECT_RANDOM_VERTICES test #4034

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/tests/structure/mg_select_random_vertices_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class Tests_MGSelectRandomVertices
std::iota(
h_given_set.begin(), h_given_set.end(), mg_graph_view.local_vertex_partition_range_first());
std::shuffle(h_given_set.begin(), h_given_set.end(), std::mt19937{std::random_device{}()});
h_given_set.resize(std::rand() % mg_graph_view.local_vertex_partition_range_size() + 1);
h_given_set.resize(std::rand() % (mg_graph_view.local_vertex_partition_range_size() + 1));

// Compute size of the distributed vertex set
int num_of_elements_in_given_set = static_cast<int>(h_given_set.size());
Expand All @@ -105,7 +105,7 @@ class Tests_MGSelectRandomVertices
size_t select_count =
num_of_elements_in_given_set > select_random_vertices_usecase.select_count
? select_random_vertices_usecase.select_count
: std::rand() % num_of_elements_in_given_set + 1;
: std::rand() % (num_of_elements_in_given_set + 1);

for (int idx = 0; idx < with_replacement_flags.size(); idx++) {
bool with_replacement = with_replacement_flags[idx];
Expand Down
Loading