Skip to content

Commit

Permalink
Add getter for totalWeight to WeightedRandomSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
marecabo committed Mar 1, 2024
1 parent b78e7c7 commit 97c94ba
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public int size() {
return entryList.size();
}

public double getTotalWeight() {
return totalWeight;
}

private record Entry<E>(E e, double cumulativeWeight) implements Comparable<Entry<E>> {
public int compareTo(Entry<E> o) {
double diff = this.cumulativeWeight - o.cumulativeWeight;
Expand Down

0 comments on commit 97c94ba

Please sign in to comment.