Home
last modified time | relevance | path

Searched refs:WeightedIndex (Results 1 – 6 of 6) sorted by relevance

/external/rust/crates/rand/src/distributions/
Dweighted_index.rs81 pub struct WeightedIndex<X: SampleUniform + PartialOrd> { struct
87 impl<X: SampleUniform + PartialOrd> WeightedIndex<X> { impl
96 pub fn new<I>(weights: I) -> Result<WeightedIndex<X>, WeightedError> in new()
126 Ok(WeightedIndex { in new()
223 impl<X> Distribution<usize> for WeightedIndex<X> implementation
249 let weighted_index = WeightedIndex::new(&[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).unwrap(); in test_weightedindex_serde1()
252 let de_weighted_index: WeightedIndex<i32> = in test_weightedindex_serde1()
265 WeightedIndex::new(&[core::f32::NAN, 0.5]).unwrap_err(), in test_accepting_nan()
269 WeightedIndex::new(&[core::f32::NAN]).unwrap_err(), in test_accepting_nan()
273 WeightedIndex::new(&[0.5, core::f32::NAN]).unwrap_err(), in test_accepting_nan()
[all …]
Dweighted.rs14 pub use super::{WeightedIndex, WeightedError};
26 pub struct WeightedIndex<W: Weight> { struct
29 impl<W: Weight> WeightedIndex<W> { implementation
Dmod.rs105 pub use self::weighted_index::{WeightedError, WeightedIndex};
/external/cldr/tools/java/org/unicode/cldr/util/
DPick.java210 private WeightedIndex weightedIndex = new WeightedIndex(0);
279 WeightedIndex weightedIndex;
284 weightedIndex = new WeightedIndex(minCount).add(maxCount - minCount + 1, itemWeights); in Repeat()
380 private static final WeightedIndex choice = new WeightedIndex(0)
684 public static class WeightedIndex { class in Pick
689 public WeightedIndex(int minCount) { in WeightedIndex() method in Pick.WeightedIndex
693 public WeightedIndex add(int count, int itemWeights) { in add()
703 public WeightedIndex add(int[] newWeights) { in add()
707 public WeightedIndex add(int maxCount, int[] newWeights) { in add()
/external/rust/crates/rand/
DCHANGELOG.md55 - Added a `serde1` feature and added Serialize/Deserialize to `UniformInt` and `WeightedIndex` (#97…
67 - `rand::distributions::alias_method::WeightedIndex` was moved to `rand_distr::WeightedAliasIndex`.
68 The simpler alternative `rand::distribution::WeightedIndex` remains. (#945)
69 - Improve treatment of rounding errors in `WeightedIndex::update_weights` (#956)
70 - `WeightedIndex`: return error on NaN instead of panic (#1005)
113 - `WeightedIndex`: allow adjusting a sub-set of weights (#866)
149 - Added `distributions::weighted::alias_method::WeightedIndex` for `O(1)` sampling (#692)
246 - Add `WeightedIndex` and `choose_weighted` (#518, #547)
/external/rust/crates/rand/src/seq/
Dmod.rs539 use crate::distributions::{Distribution, WeightedIndex}; in choose_weighted()
540 let distr = WeightedIndex::new(self.iter().map(weight))?; in choose_weighted()
558 use crate::distributions::{Distribution, WeightedIndex}; in choose_weighted_mut()
559 let distr = WeightedIndex::new(self.iter().map(weight))?; in choose_weighted_mut()