Doc: fix formatting

This commit is contained in:
Diggory Hardy 2018-04-05 10:54:06 +01:00
parent 29b2012172
commit 79c92a54a6
4 changed files with 15 additions and 11 deletions
src

@ -272,9 +272,9 @@ impl<'a, T, D: Distribution<T>> Distribution<T> for &'a D {
///
/// - The chance to generate a specific value, like exactly 0.0, is *tiny*. No
/// (or almost no) sensible code relies on an exact floating-point value to be
/// generated with a very small chance (1 in ~8 million (2^23) for `f32`, and
/// 1 in 2^52 for `f64`). What is relied on is having a uniform distribution
/// and a mean of `0.5`.
/// generated with a very small chance (1 in 2<sup>23</sup> (approx. 8
/// million) for `f32`, and 1 in 2<sup>52</sup> for `f64`). What is relied on
/// is having a uniform distribution and a mean of `0.5`.
/// - Several common algorithms rely on never seeing the value `0.0` generated,
/// i.e. they rely on an open interval. For example when the logarithm of the
/// value is taken, or used as a devisor.

@ -476,9 +476,9 @@ pub trait Rng: RngCore {
/// # Accuracy note
///
/// `gen_bool` uses 32 bits of the RNG, so if you use it to generate close
/// to or more than 2^32 results, a tiny bias may become noticable.
/// to or more than `2^32` results, a tiny bias may become noticable.
/// A notable consequence of the method used here is that the worst case is
/// `rng.gen_bool(0.0)`: it has a chance of 1 in 2^32 of being true, while
/// `rng.gen_bool(0.0)`: it has a chance of 1 in `2^32` of being true, while
/// it should always be false. But using `gen_bool` to consume *many* values
/// from an RNG just to consistently generate `false` does not match with
/// the intent of this method.

@ -162,11 +162,11 @@ impl BlockRngCore for IsaacCore {
type Item = u32;
type Results = IsaacArray<Self::Item>;
/// Refills the output buffer (`results`)
/// See also the pseudocode desciption of the algorithm at the top of this
/// file.
/// Refills the output buffer, `results`. See also the pseudocode desciption
/// of the algorithm in the [`Isaac64Rng`] documentation.
///
/// Optimisations used (similar to the reference implementation):
///
/// - The loop is unrolled 4 times, once for every constant of mix().
/// - The contents of the main loop are moved to a function `rngstep`, to
/// reduce code duplication.
@ -181,6 +181,8 @@ impl BlockRngCore for IsaacCore {
/// from `results` in reverse. We read them in the normal direction, to
/// make `fill_bytes` a memcopy. To maintain compatibility we fill in
/// reverse.
///
/// [`IsaacRng`]: struct.IsaacRng.html
fn generate(&mut self, results: &mut IsaacArray<Self::Item>) {
self.c += w(1);
// abbreviations

@ -152,11 +152,11 @@ impl BlockRngCore for Isaac64Core {
type Item = u64;
type Results = IsaacArray<Self::Item>;
/// Refills the output buffer (`results`)
/// See also the pseudocode desciption of the algorithm at the top of this
/// file.
/// Refills the output buffer, `results`. See also the pseudocode desciption
/// of the algorithm in the [`Isaac64Rng`] documentation.
///
/// Optimisations used (similar to the reference implementation):
///
/// - The loop is unrolled 4 times, once for every constant of mix().
/// - The contents of the main loop are moved to a function `rngstep`, to
/// reduce code duplication.
@ -171,6 +171,8 @@ impl BlockRngCore for Isaac64Core {
/// from `results` in reverse. We read them in the normal direction, to
/// make `fill_bytes` a memcopy. To maintain compatibility we fill in
/// reverse.
///
/// [`Isaac64Rng`]: struct.Isaac64Rng.html
fn generate(&mut self, results: &mut IsaacArray<Self::Item>) {
self.c += w(1);
// abbreviations