Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rounding error fix on WeightedIndex::update_weights()
WeightedIndex::update_weights() uses subtraction on old_w. Rounding errors, particularly on f32, may bring total_weight to below 0. This PR makes sure a negative total_weight results in an error. This replaces PR rust-random#955 which was invalidated after a merge. Thanks for your consideration!
- Loading branch information