@@ -35,10 +35,10 @@ use serde::{Deserialize, Serialize};
35
35
/// Time complexity of sampling from `WeightedIndex` is `O(log N)` where
36
36
/// `N` is the number of weights. There are two alternative implementations with
37
37
/// different runtimes characteristics:
38
- /// * [`rand_distr::weighted_alias`](https://docs.rs/rand_distr/*/rand_distr/weighted_alias/index.html)
39
- /// supports `O(1)` sampling, but with much higher initialisation cost.
40
- /// * [`rand_distr::weighted_tree`](https://docs.rs/rand_distr/*/rand_distr/weighted_tree/index.html)
41
- /// keeps the weights in a tree structure where sampling and updating is `O(log N)`.
38
+ /// * [`rand_distr::weighted_alias`] supports `O(1)` sampling, but with much higher
39
+ /// initialisation cost.
40
+ /// * [`rand_distr::weighted_tree`] keeps the weights in a tree structure where sampling
41
+ /// and updating is `O(log N)`.
42
42
///
43
43
/// A `WeightedIndex<X>` contains a `Vec<X>` and a [`Uniform<X>`] and so its
44
44
/// size is the sum of the size of those objects, possibly plus some alignment.
@@ -80,6 +80,8 @@ use serde::{Deserialize, Serialize};
80
80
///
81
81
/// [`Uniform<X>`]: crate::distributions::Uniform
82
82
/// [`RngCore`]: crate::RngCore
83
+ /// [`rand_distr::weighted_alias`]: https://docs.rs/rand_distr/*/rand_distr/weighted_alias/index.html
84
+ /// [`rand_distr::weighted_tree`]: https://docs.rs/rand_distr/*/rand_distr/weighted_tree/index.html
83
85
#[ derive( Debug , Clone , PartialEq ) ]
84
86
#[ cfg_attr( feature = "serde1" , derive( Serialize , Deserialize ) ) ]
85
87
pub struct WeightedIndex < X : SampleUniform + PartialOrd > {
0 commit comments