// trait called `Sample` and the other should be `DependentSample`.
pub trait IndependentSample<Support>: Sample<Support> {
/// Generate a random value.
- fn ind_sample<R: Rng>(&self, &mut R) -> Support;
+ fn ind_sample<R: Rng>(&self, _: &mut R) -> Support;
}
/// A wrapper for generating types that implement `Rand` via the
pub item: T,
}
-impl<T> fmt::Debug for Weighted<T> {
- default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad("Weighted")
- }
-}
-
impl<T: fmt::Debug> fmt::Debug for Weighted<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Weighted")
"WeightedChoice::new called with a total weight of 0");
WeightedChoice {
- items: items,
+ items,
// we're likely to be generating numbers in this range
// relatively often, so might as well cache it
weight_range: Range::new(0, running_total),
}
}
-impl<'a, T> fmt::Debug for WeightedChoice<'a, T> {
- default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad("WeightedChoice")
- }
-}
-
impl<'a, T: fmt::Debug> fmt::Debug for WeightedChoice<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("WeightedChoice")