Skip to content

Commit ef9e6a0

Browse files
committed
Fix doc links for new weighted code
1 parent 131035e commit ef9e6a0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/distributions/weighted/alias_method.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ use Rng;
5454
/// }
5555
/// ```
5656
///
57-
/// [`WeightedIndex<W>`]: WeightedIndex
58-
/// [`Weight`]: Weight
57+
/// [`WeightedIndex<W>`]: crate::distributions::weighted::alias_method::WeightedIndex
58+
/// [`Weight`]: crate::distributions::weighted::alias_method::Weight
5959
/// [`Vec<usize>`]: Vec
6060
/// [`Uniform<usize>::sample`]: Distribution::sample
6161
/// [`Uniform<W>::sample`]: Distribution::sample
@@ -282,7 +282,9 @@ pub trait Weight:
282282
/// Element of `Self` equivalent to 0.
283283
const ZERO: Self;
284284

285-
/// Converts a [`usize`] to a `Self`, rounding if necessary.
285+
/// Produce an instance of `Self` from a `usize` value, or return `None` if
286+
/// out of range. Loss of precision (where `Self` is a floating point type)
287+
/// is acceptable.
286288
fn try_from_usize_lossy(n: usize) -> Option<Self>;
287289

288290
/// Sums all values in slice `values`.

src/distributions/weighted/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use core::fmt;
7373
/// ```
7474
///
7575
/// [`Uniform<X>`]: crate::distributions::uniform::Uniform
76-
/// [`RngCore`]: rand_core::RngCore
76+
/// [`RngCore`]: crate::RngCore
7777
#[derive(Debug, Clone)]
7878
pub struct WeightedIndex<X: SampleUniform + PartialOrd> {
7979
cumulative_weights: Vec<X>,

0 commit comments

Comments
 (0)