Skip to content

Commit 743661e

Browse files
committed
rand: fix incorrect example in Uniform
The current example to implement `SampleUniform` for custom types is incorrect. It mistakenly forwards the implementation of `UniformSampler::new_inclusive` to `UniformSampler::new`.
1 parent f8106ef commit 743661e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/distributions/uniform.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@
8080
//! where B1: SampleBorrow<Self::X> + Sized,
8181
//! B2: SampleBorrow<Self::X> + Sized
8282
//! {
83-
//! UniformSampler::new(low, high)
83+
//! UniformMyF32(UniformFloat::<f32>::new_inclusive(
84+
//! low.borrow().0,
85+
//! high.borrow().0,
86+
//! ))
8487
//! }
8588
//! fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
8689
//! MyF32(self.0.sample(rng))

0 commit comments

Comments
 (0)