Skip to content
Snippets Groups Projects
Commit a5cbfbad authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Fix bug in DiscreteDistribution::dichotomy

parent 704170d8
No related branches found
No related tags found
No related merge requests found
...@@ -135,7 +135,7 @@ namespace hpp { ...@@ -135,7 +135,7 @@ namespace hpp {
size_t l = 0, h = values_.size () - 1, m; size_t l = 0, h = values_.size () - 1, m;
while (l < h - 1) { while (l < h - 1) {
m = (l + h) / 2; m = (l + h) / 2;
if (cumulative_weights_[m] < r) if (cumulative_weights_[m] <= r)
l = m; l = m;
else if (cumulative_weights_[m] > r) else if (cumulative_weights_[m] > r)
h = m; h = m;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment