summaryrefslogtreecommitdiff
path: root/autofeur_db/src/trie.rs
diff options
context:
space:
mode:
Diffstat (limited to 'autofeur_db/src/trie.rs')
-rw-r--r--autofeur_db/src/trie.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/autofeur_db/src/trie.rs b/autofeur_db/src/trie.rs
index 6d0867a..a14c56e 100644
--- a/autofeur_db/src/trie.rs
+++ b/autofeur_db/src/trie.rs
@@ -109,11 +109,11 @@ impl<'a> Trie<'a> {
while current_node.child_nodes.len() != 0 {
// We need to choose a random child based on weights
let weighted = WeightedIndex::new(current_node.child_nodes.iter().map(|(_, node)| {
- node.child_count / node
+ node.child_count / (node
.child_nodes
.iter()
.map(|(_, b)| b.child_count)
- .sum::<u64>()
+ .sum::<u64>() + 1)
}))
.expect("distribution creation should be valid");