We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2375dc commit b10172fCopy full SHA for b10172f
rand_distr/src/weighted_tree.rs
@@ -247,7 +247,7 @@ impl<W: Clone + PartialEq + PartialOrd + SampleUniform + SubAssign<W> + Weight>
247
///
248
/// Returns an error if there are no elements or all weights are zero. This
249
/// is unlike [`Distribution::sample`], which panics in those cases.
250
- fn try_sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Result<usize, WeightError> {
+ pub fn try_sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Result<usize, WeightError> {
251
let total_weight = self.subtotals.first().cloned().unwrap_or(W::ZERO);
252
if total_weight == W::ZERO {
253
return Err(WeightError::InsufficientNonZero);
0 commit comments