Skip to content

Commit

Permalink
Add explanatory comment about the weighted shuffle.
Browse files Browse the repository at this point in the history
  • Loading branch information
ll-nick committed Apr 22, 2024
1 parent 7006a9e commit 86946a7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/arbitration_graphs/random_arbitrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class RandomArbitrator : public Arbitrator<CommandT, SubCommandT, VerifierT, Ver
std::random_device randomDevice;
std::mt19937 randomGenerator(randomDevice());

// A weighted shuffle is equivalent to a weighted sampling of options without replacement.
while (!weights.empty()) {
std::discrete_distribution<int> discreteDistribution(weights.begin(), weights.end());
auto index = discreteDistribution(randomGenerator);
Expand Down

0 comments on commit 86946a7

Please sign in to comment.