File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -162,9 +162,9 @@ pub trait UniformImpl: Sized {
162
162
/// this.
163
163
///
164
164
/// Via this method, implementations can provide a method optimized for
165
- /// sampling only a limited number of values from the range. The default
166
- /// implementation just sets up a `Uniform` with ` UniformImpl::new` and samples
167
- /// from that .
165
+ /// sampling only a single value from the specified range. The default
166
+ /// implementation simply calls ` UniformImpl::new` then `sample` on the
167
+ /// result .
168
168
fn sample_single < R : Rng + ?Sized > ( low : Self :: X , high : Self :: X , rng : & mut R )
169
169
-> Self :: X
170
170
{
Original file line number Diff line number Diff line change @@ -325,10 +325,11 @@ pub trait Rng: RngCore {
325
325
/// `low` and exclusive of `high`.
326
326
///
327
327
/// This is a convenience wrapper around
328
- /// `distributions::Uniform`. If this function will be called
329
- /// repeatedly with the same arguments, one should use `Uniform`, as
330
- /// that will amortize the computations that allow for perfect
331
- /// uniformity, as they only happen when constructing the `Uniform`.
328
+ /// `distributions::Uniform::sample_single`. If this function will be called
329
+ /// repeatedly with the same arguments, it will likely be faster to
330
+ /// construct a `Uniform` distribution object and sample from that; this
331
+ /// allows amortization of the computations that allow for perfect
332
+ /// uniformity within the `Uniform::new` constructor.
332
333
///
333
334
/// # Panics
334
335
///
You can’t perform that action at this time.
0 commit comments