Skip to content

Commit

Permalink
rand: fix incorrect example in Uniform
Browse files Browse the repository at this point in the history
The current example to implement `SampleUniform` for custom types is incorrect.
It mistakenly forwards the implementation of `UniformSampler::new_inclusive` to
`UniformSampler::new`.
  • Loading branch information
xu-cheng committed Nov 24, 2021
1 parent f8106ef commit 743661e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/distributions/uniform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
//! where B1: SampleBorrow<Self::X> + Sized,
//! B2: SampleBorrow<Self::X> + Sized
//! {
//! UniformSampler::new(low, high)
//! UniformMyF32(UniformFloat::<f32>::new_inclusive(
//! low.borrow().0,
//! high.borrow().0,
//! ))
//! }
//! fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
//! MyF32(self.0.sample(rng))
Expand Down

0 comments on commit 743661e

Please sign in to comment.