Skip to content

Commit

Permalink
Merge pull request #1138 from striezel-stash/fix-typos
Browse files Browse the repository at this point in the history
fix some typos
  • Loading branch information
vks committed Jun 15, 2021
2 parents 8792268 + 277e5b0 commit 8a07c93
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -678,4 +678,4 @@ when updating from `rand 0.7.0` without also updating `rand_core`.

## [0.10-pre] - 2014-03-02
### Added
- Seperate `rand` out of the standard library
- Separate `rand` out of the standard library
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -143,7 +143,7 @@ unavailable.

The WASM target `wasm32-unknown-unknown` is not *automatically* supported by
`rand` or `getrandom`. To solve this, either use a different target such as
`wasm32-wasi` or add a direct dependancy on `getrandom` with the `js` feature
`wasm32-wasi` or add a direct dependency on `getrandom` with the `js` feature
(if the target supports JavaScript). See
[getrandom#WebAssembly support](https://docs.rs/getrandom/latest/getrandom/#webassembly-support).

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Expand Up @@ -8,7 +8,7 @@ No binding guarantees can be provided.
## Security premises

Rand provides the trait `rand_core::CryptoRng` aka `rand::CryptoRng` as a marker
trait. Generators implementating `RngCore` *and* `CryptoRng`, and given the
trait. Generators implementing `RngCore` *and* `CryptoRng`, and given the
additional constraints that:

- Instances of seedable RNGs (those implementing `SeedableRng`) are
Expand Down
2 changes: 1 addition & 1 deletion rand_core/src/block.rs
Expand Up @@ -95,7 +95,7 @@ pub trait BlockRngCore {
/// [`fill_bytes`] / [`try_fill_bytes`] is called on a large array. These methods
/// also handle the bookkeeping of when to generate a new batch of values.
///
/// No whole generated `u32` values are thown away and all values are consumed
/// No whole generated `u32` values are thrown away and all values are consumed
/// in-order. [`next_u32`] simply takes the next available `u32` value.
/// [`next_u64`] is implemented by combining two `u32` values, least
/// significant first. [`fill_bytes`] and [`try_fill_bytes`] consume a whole
Expand Down
2 changes: 1 addition & 1 deletion rand_distr/README.md
Expand Up @@ -28,7 +28,7 @@ for some distributions (in particular, `Dirichlet` and `WeightedAliasIndex`).

The floating point functions from `num_traits` and `libm` are used to support
`no_std` environments and ensure reproducibility. If the floating point
functions from `std` are prefered, which may provide better accuracy and
functions from `std` are preferred, which may provide better accuracy and
performance but may produce different random values, the `std_math` feature
can be enabled.

Expand Down
4 changes: 2 additions & 2 deletions rand_distr/src/binomial.rs
Expand Up @@ -105,7 +105,7 @@ impl Distribution<u64> for Binomial {
// random variate generation. Commun. ACM 31, 2 (February 1988),
// 216-222. http://dx.doi.org/10.1145/42372.42381

// Threshold for prefering the BINV algorithm. The paper suggests 10,
// Threshold for preferring the BINV algorithm. The paper suggests 10,
// Ranlib uses 30, and GSL uses 14.
const BINV_THRESHOLD: f64 = 10.;

Expand Down Expand Up @@ -242,7 +242,7 @@ impl Distribution<u64> for Binomial {
}
}

// Step 5.2: Squeezing. Check the value of ln(v) againts upper and
// Step 5.2: Squeezing. Check the value of ln(v) against upper and
// lower bound of ln(f(y)).
let k = k as f64;
let rho = (k / npq) * ((k * (k / 3. + 0.625) + 1. / 6.) / npq + 0.5);
Expand Down
2 changes: 1 addition & 1 deletion rand_distr/src/hypergeometric.rs
Expand Up @@ -29,7 +29,7 @@ enum SamplingMethod {
/// `f(k) = binomial(K, k) * binomial(N-K, n-k) / binomial(N, n)`,
/// where `binomial(a, b) = a! / (b! * (a - b)!)`.
///
/// The [binomial distribution](crate::Binomial) is the analagous distribution
/// The [binomial distribution](crate::Binomial) is the analogous distribution
/// for sampling with replacement. It is a good approximation when the population
/// size is much larger than the sample size.
///
Expand Down
2 changes: 1 addition & 1 deletion rand_distr/src/poisson.rs
Expand Up @@ -109,7 +109,7 @@ where F: Float + FloatConst, Standard: Distribution<F>
loop {
// draw from the Cauchy distribution
comp_dev = rng.sample(cauchy);
// shift the peak of the comparison ditribution
// shift the peak of the comparison distribution
result = self.sqrt_2lambda * comp_dev + self.lambda;
// repeat the drawing until we are in the range of possible values
if result >= F::zero() {
Expand Down
8 changes: 4 additions & 4 deletions rand_distr/src/utils.rs
Expand Up @@ -91,14 +91,14 @@ where
let i = bits as usize & 0xff;

let u = if symmetric {
// Convert to a value in the range [2,4) and substract to get [-1,1)
// Convert to a value in the range [2,4) and subtract to get [-1,1)
// We can't convert to an open range directly, that would require
// substracting `3.0 - EPSILON`, which is not representable.
// subtracting `3.0 - EPSILON`, which is not representable.
// It is possible with an extra step, but an open range does not
// seem neccesary for the ziggurat algorithm anyway.
// seem necessary for the ziggurat algorithm anyway.
(bits >> 12).into_float_with_exponent(1) - 3.0
} else {
// Convert to a value in the range [1,2) and substract to get (0,1)
// Convert to a value in the range [1,2) and subtract to get (0,1)
(bits >> 12).into_float_with_exponent(0) - (1.0 - core::f64::EPSILON / 2.0)
};
let x = u * x_tab[i];
Expand Down
4 changes: 2 additions & 2 deletions rand_hc/src/hc128.rs
Expand Up @@ -142,7 +142,7 @@ impl BlockRngCore for Hc128Core {
let dd = (cc + 16) % 512;
let ee = cc.wrapping_sub(16) % 512;
// These asserts let the compiler optimize out the bounds checks.
// Some of them may be superflous, and that's fine:
// Some of them may be superfluous, and that's fine:
// they'll be optimized out if that's the case.
assert!(ee + 15 < 512);
assert!(cc + 15 < 512);
Expand Down Expand Up @@ -238,7 +238,7 @@ impl Hc128Core {
let dd = (cc + 16) % 512;
let ee = cc.wrapping_sub(16) % 512;
// These asserts let the compiler optimize out the bounds checks.
// Some of them may be superflous, and that's fine:
// Some of them may be superfluous, and that's fine:
// they'll be optimized out if that's the case.
assert!(ee + 15 < 512);
assert!(cc + 15 < 512);
Expand Down
2 changes: 1 addition & 1 deletion rand_pcg/src/pcg128.rs
Expand Up @@ -93,7 +93,7 @@ impl Lcg128Xsl64 {
#[inline]
fn from_state_incr(state: u128, increment: u128) -> Self {
let mut pcg = Lcg128Xsl64 { state, increment };
// Move away from inital value:
// Move away from initial value:
pcg.state = pcg.state.wrapping_add(pcg.increment);
pcg.step();
pcg
Expand Down
2 changes: 1 addition & 1 deletion rand_pcg/src/pcg64.rs
Expand Up @@ -94,7 +94,7 @@ impl Lcg64Xsh32 {
#[inline]
fn from_state_incr(state: u64, increment: u64) -> Self {
let mut pcg = Lcg64Xsh32 { state, increment };
// Move away from inital value:
// Move away from initial value:
pcg.state = pcg.state.wrapping_add(pcg.increment);
pcg.step();
pcg
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/bernoulli.rs
Expand Up @@ -49,7 +49,7 @@ pub struct Bernoulli {
// `f64` only has 53 bits of precision, and the next largest value of `p` will
// result in `2^64 - 2048`.
//
// Also there is a 100% theoretical concern: if someone consistenly wants to
// Also there is a 100% theoretical concern: if someone consistently wants to
// generate `true` using the Bernoulli distribution (i.e. by using a probability
// of `1.0`), just using `u64::MAX` is not enough. On average it would return
// false once every 2^64 iterations. Some people apparently care about this
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/float.rs
Expand Up @@ -78,7 +78,7 @@ pub struct Open01;
pub trait IntoFloat {
type F;

/// Helper method to combine the fraction and a contant exponent into a
/// Helper method to combine the fraction and a constant exponent into a
/// float.
///
/// Only the least significant bits of `self` may be set, 23 for `f32` and
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/uniform.rs
Expand Up @@ -158,7 +158,7 @@ use serde::{Serialize, Deserialize};
/// println!("{}", sum);
/// ```
///
/// For a single sample, [`Rng::gen_range`] may be prefered:
/// For a single sample, [`Rng::gen_range`] may be preferred:
///
/// ```
/// use rand::Rng;
Expand Down
4 changes: 2 additions & 2 deletions src/rngs/thread.rs
Expand Up @@ -33,7 +33,7 @@ use crate::{CryptoRng, Error, RngCore, SeedableRng};


// Number of generated bytes after which to reseed `ThreadRng`.
// According to benchmarks, reseeding has a noticable impact with thresholds
// According to benchmarks, reseeding has a noticeable impact with thresholds
// of 32 kB and less. We choose 64 kB to avoid significant overhead.
const THREAD_RNG_RESEED_THRESHOLD: u64 = 1024 * 64;

Expand All @@ -59,7 +59,7 @@ const THREAD_RNG_RESEED_THRESHOLD: u64 = 1024 * 64;
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "std", feature = "std_rng"))))]
#[derive(Clone, Debug)]
pub struct ThreadRng {
// Rc is explictly !Send and !Sync
// Rc is explicitly !Send and !Sync
rng: Rc<UnsafeCell<ReseedingRng<Core, OsRng>>>,
}

Expand Down

0 comments on commit 8a07c93

Please sign in to comment.