From bc4c9a6a50084e958cf5969e7b91b0a2683ab708 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Wed, 1 Apr 2020 17:46:57 +0200 Subject: [PATCH] doc: 2020-04-01 17:46:07 +0200: 1da288b - Fix links to grammar definitions --- implementors/core/clone/trait.Clone.js | 2 +- implementors/core/cmp/trait.Eq.js | 2 +- implementors/core/cmp/trait.PartialEq.js | 2 +- implementors/core/fmt/trait.Debug.js | 2 +- implementors/core/fmt/trait.Display.js | 2 +- .../iter/traits/iterator/trait.Iterator.js | 2 +- .../iter/traits/marker/trait.FusedIterator.js | 2 +- implementors/core/marker/trait.Copy.js | 2 +- implementors/core/marker/trait.Freeze.js | 2 +- implementors/core/marker/trait.Send.js | 2 +- .../core/marker/trait.StructuralEq.js | 2 +- .../core/marker/trait.StructuralPartialEq.js | 2 +- implementors/core/marker/trait.Sync.js | 2 +- implementors/core/marker/trait.Unpin.js | 2 +- implementors/rand/trait.RngCore.js | 2 +- implementors/rand/trait.SeedableRng.js | 2 +- implementors/std/error/trait.Error.js | 2 +- implementors/std/panic/trait.RefUnwindSafe.js | 2 +- implementors/std/panic/trait.UnwindSafe.js | 2 +- rand/all.html | 2 +- rand/distributions/index.html | 185 +++-- rand/distributions/sidebar-items.js | 2 +- rand/distributions/struct.Alphanumeric.html | 10 +- rand/distributions/struct.Bernoulli.html | 28 +- rand/distributions/struct.Beta.html | 22 +- rand/distributions/struct.Binomial.html | 22 +- rand/distributions/struct.Cauchy.html | 22 +- rand/distributions/struct.ChiSquared.html | 22 +- rand/distributions/struct.Dirichlet.html | 25 +- rand/distributions/struct.DistIter.html | 20 +- rand/distributions/struct.Exp.html | 24 +- rand/distributions/struct.Exp1.html | 20 +- rand/distributions/struct.FisherF.html | 22 +- rand/distributions/struct.Gamma.html | 22 +- rand/distributions/struct.LogNormal.html | 23 +- rand/distributions/struct.Normal.html | 23 +- rand/distributions/struct.Open01.html | 18 +- rand/distributions/struct.OpenClosed01.html | 18 +- rand/distributions/struct.Pareto.html | 22 +- rand/distributions/struct.Poisson.html | 22 +- rand/distributions/struct.Standard.html | 290 +++---- rand/distributions/struct.StandardNormal.html | 20 +- rand/distributions/struct.StudentT.html | 22 +- rand/distributions/struct.Triangular.html | 22 +- rand/distributions/struct.Uniform.html | 20 +- rand/distributions/struct.UnitCircle.html | 22 +- .../struct.UnitSphereSurface.html | 22 +- rand/distributions/struct.Weibull.html | 22 +- rand/distributions/trait.Distribution.html | 28 +- rand/distributions/uniform/index.html | 12 +- .../distributions/uniform/struct.Uniform.html | 20 +- .../uniform/struct.UniformDuration.html | 18 +- .../uniform/struct.UniformFloat.html | 30 +- .../uniform/struct.UniformInt.html | 167 ++-- .../uniform/trait.SampleBorrow.html | 6 +- .../uniform/trait.SampleUniform.html | 4 +- .../uniform/trait.UniformSampler.html | 25 +- .../weighted/enum.WeightedError.html | 50 +- .../weighted/struct.WeightedIndex.html | 82 +- rand/fn.random.html | 2 +- rand/fn.thread_rng.html | 4 +- rand/index.html | 16 +- rand/prelude/index.html | 4 +- rand/rngs/adapter/index.html | 3 +- rand/rngs/adapter/sidebar-items.js | 2 +- rand/rngs/adapter/struct.ReadRng.html | 40 +- rand/rngs/adapter/struct.ReseedingRng.html | 51 +- rand/rngs/index.html | 171 ++-- rand/rngs/mock/index.html | 2 +- rand/rngs/mock/struct.StepRng.html | 38 +- rand/rngs/sidebar-items.js | 2 +- rand/rngs/struct.EntropyRng.html | 60 +- rand/rngs/struct.OsRng.html | 60 +- rand/rngs/struct.StdRng.html | 63 +- rand/rngs/struct.ThreadRng.html | 65 +- rand/seq/index.html | 26 +- rand/seq/index/enum.IndexVec.html | 25 +- rand/seq/index/enum.IndexVecIntoIter.html | 22 +- rand/seq/index/enum.IndexVecIter.html | 20 +- rand/seq/index/fn.sample.html | 2 +- rand/seq/index/index.html | 2 +- rand/seq/sidebar-items.js | 2 +- rand/seq/struct.SliceChooseIter.html | 22 +- rand/seq/trait.IteratorRandom.html | 49 +- rand/seq/trait.SliceRandom.html | 67 +- rand/sidebar-items.js | 2 +- rand/struct.Error.html | 69 +- rand/trait.AsByteSliceMut.html | 4 +- rand/trait.CryptoRng.html | 6 +- rand/trait.Rng.html | 57 +- rand/trait.RngCore.html | 8 +- rand/trait.SeedableRng.html | 87 +- search-index.js | 2 +- source-files.js | 2 +- src/rand/distributions/bernoulli.rs.html | 138 +-- src/rand/distributions/binomial.rs.html | 442 ++-------- src/rand/distributions/cauchy.rs.html | 262 +++--- src/rand/distributions/dirichlet.rs.html | 42 +- src/rand/distributions/exponential.rs.html | 64 +- src/rand/distributions/float.rs.html | 170 +--- src/rand/distributions/gamma.rs.html | 166 +++- src/rand/distributions/integer.rs.html | 294 +------ src/rand/distributions/mod.rs.html | 786 +++++++++++++----- src/rand/distributions/normal.rs.html | 104 ++- src/rand/distributions/other.rs.html | 212 +---- src/rand/distributions/pareto.rs.html | 30 +- src/rand/distributions/poisson.rs.html | 36 +- src/rand/distributions/triangular.rs.html | 36 +- src/rand/distributions/uniform.rs.html | 756 +++++++---------- src/rand/distributions/unit_circle.rs.html | 58 +- src/rand/distributions/unit_sphere.rs.html | 60 +- src/rand/distributions/utils.rs.html | 232 ++---- src/rand/distributions/weibull.rs.html | 30 +- .../distributions/ziggurat_tables.rs.html | 10 +- src/rand/lib.rs.html | 558 +++++++++---- src/rand/prelude.rs.html | 30 +- src/rand/rngs/adapter/mod.rs.html | 6 +- src/rand/rngs/adapter/read.rs.html | 80 +- src/rand/rngs/adapter/reseeding.rs.html | 178 ++-- src/rand/rngs/entropy.rs.html | 524 ++++++++++-- src/rand/rngs/mock.rs.html | 30 +- src/rand/rngs/mod.rs.html | 272 ++++-- src/rand/rngs/std.rs.html | 252 +++--- src/rand/rngs/thread.rs.html | 98 ++- src/rand/seq/index.rs.html | 276 ++---- src/rand/seq/mod.rs.html | 646 +++++++------- 126 files changed, 4736 insertions(+), 4693 deletions(-) diff --git a/implementors/core/clone/trait.Clone.js b/implementors/core/clone/trait.Clone.js index 9b8e11d..c654ca9 100644 --- a/implementors/core/clone/trait.Clone.js +++ b/implementors/core/clone/trait.Clone.js @@ -61,7 +61,7 @@ implementors["parser"] = [{"text":"impl<'input> Clone for PercentEncode<'a>","synthetic":false,"types":["percent_encoding::PercentEncode"]},{"text":"impl<'a> Clone for PercentDecode<'a>","synthetic":false,"types":["percent_encoding::PercentDecode"]}]; implementors["ppv_lite86"] = [{"text":"impl Clone for YesS3","synthetic":false,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Clone for NoS3","synthetic":false,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Clone for YesS4","synthetic":false,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Clone for NoS4","synthetic":false,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Clone for YesA1","synthetic":false,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Clone for NoA1","synthetic":false,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Clone for YesA2","synthetic":false,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Clone for NoA2","synthetic":false,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Clone for YesNI","synthetic":false,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Clone for NoNI","synthetic":false,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3: Clone, S4: Clone, NI: Clone> Clone for SseMachine<S3, S4, NI>","synthetic":false,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI: Clone> Clone for Avx2Machine<NI>","synthetic":false,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Clone for vec128_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Clone for vec256_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Clone for vec512_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl Clone for TokenStream","synthetic":false,"types":["proc_macro2::TokenStream"]},{"text":"impl Clone for Span","synthetic":false,"types":["proc_macro2::Span"]},{"text":"impl Clone for TokenTree","synthetic":false,"types":["proc_macro2::TokenTree"]},{"text":"impl Clone for Group","synthetic":false,"types":["proc_macro2::Group"]},{"text":"impl Clone for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl Clone for Punct","synthetic":false,"types":["proc_macro2::Punct"]},{"text":"impl Clone for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]},{"text":"impl Clone for Ident","synthetic":false,"types":["proc_macro2::Ident"]},{"text":"impl Clone for Literal","synthetic":false,"types":["proc_macro2::Literal"]},{"text":"impl Clone for IntoIter","synthetic":false,"types":["proc_macro2::token_stream::IntoIter"]}]; -implementors["rand"] = [{"text":"impl Clone for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Clone for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Clone for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Clone for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Clone for Dirichlet","synthetic":false,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Clone for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Clone for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Clone for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Clone for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Clone for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Clone for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Clone for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Clone for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Clone for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Clone for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Clone for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Clone for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Clone for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Clone> Clone for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Clone> Clone for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Clone for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Clone for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Clone for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Clone for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<W: Weight> Clone for WeightedIndex<W> where
    Uniform<W>: Clone
","synthetic":false,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl<X: Clone + SampleUniform + PartialOrd> Clone for WeightedIndex<X> where
    X::Sampler: Clone
","synthetic":false,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Clone for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Clone for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Clone for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Clone for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + Clone,
    Rsdr: RngCore + Clone
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Clone for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl Clone for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl Clone for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Clone for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]},{"text":"impl Clone for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Clone> Clone for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Clone> Clone for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Clone for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Clone for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X: Clone + SampleUniform + PartialOrd> Clone for WeightedIndex<X> where
    X::Sampler: Clone
","synthetic":false,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Clone for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Clone for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Clone for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Clone for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Clone for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Clone for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Clone for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Clone for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Clone for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Clone for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Clone for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Clone for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Clone for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Clone for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Clone for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Clone for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Clone for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Clone for Dirichlet","synthetic":false,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Clone for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Clone for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl Clone for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Clone for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Clone for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl<T: Clone> Clone for Weighted<T>","synthetic":false,"types":["rand::distributions::Weighted"]},{"text":"impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + Clone,
    Rsdr: RngCore + Clone
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Clone for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl Clone for SmallRng","synthetic":false,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Clone for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl Clone for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Clone for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]},{"text":"impl Clone for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl Clone for ChaCha20Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Clone for ChaCha20Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Clone for ChaCha12Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Clone for ChaCha12Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Clone for ChaCha8Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Clone for ChaCha8Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl<R: Clone + BlockRngCore + ?Sized> Clone for BlockRng<R> where
    R::Results: Clone
","synthetic":false,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: Clone + BlockRngCore + ?Sized> Clone for BlockRng64<R> where
    R::Results: Clone
","synthetic":false,"types":["rand_core::block::BlockRng64"]},{"text":"impl Clone for OsRng","synthetic":false,"types":["rand_core::os::OsRng"]}]; implementors["rand_hc"] = [{"text":"impl Clone for Hc128Rng","synthetic":false,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Clone for Hc128Core","synthetic":false,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/core/cmp/trait.Eq.js b/implementors/core/cmp/trait.Eq.js index e10ed7c..ac3257b 100644 --- a/implementors/core/cmp/trait.Eq.js +++ b/implementors/core/cmp/trait.Eq.js @@ -41,7 +41,7 @@ implementors["parking_lot"] = [{"text":"impl Eq for ParkResult","synthetic":false,"types":["parking_lot_core::parking_lot::ParkResult"]},{"text":"impl Eq for UnparkResult","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkResult"]},{"text":"impl Eq for RequeueOp","synthetic":false,"types":["parking_lot_core::parking_lot::RequeueOp"]},{"text":"impl Eq for FilterOp","synthetic":false,"types":["parking_lot_core::parking_lot::FilterOp"]},{"text":"impl Eq for UnparkToken","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkToken"]},{"text":"impl Eq for ParkToken","synthetic":false,"types":["parking_lot_core::parking_lot::ParkToken"]}]; implementors["parser"] = [{"text":"impl<'input> Eq for Token<'input>","synthetic":false,"types":["parser::queries::__intern_token::Token"]}]; implementors["proc_macro2"] = [{"text":"impl Eq for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl Eq for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]},{"text":"impl Eq for Ident","synthetic":false,"types":["proc_macro2::Ident"]}]; -implementors["rand"] = [{"text":"impl Eq for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Eq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; +implementors["rand"] = [{"text":"impl Eq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; implementors["rand_core"] = [{"text":"impl Eq for ErrorKind","synthetic":false,"types":["rand_core::error::ErrorKind"]}]; implementors["rand_jitter"] = [{"text":"impl Eq for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl<'t> Eq for Match<'t>","synthetic":false,"types":["regex::re_bytes::Match"]},{"text":"impl<'t> Eq for Match<'t>","synthetic":false,"types":["regex::re_unicode::Match"]}]; diff --git a/implementors/core/cmp/trait.PartialEq.js b/implementors/core/cmp/trait.PartialEq.js index ba9c30a..3347a8e 100644 --- a/implementors/core/cmp/trait.PartialEq.js +++ b/implementors/core/cmp/trait.PartialEq.js @@ -42,7 +42,7 @@ implementors["parking_lot"] = [{"text":"impl PartialEq<ParkResult> for ParkResult","synthetic":false,"types":["parking_lot_core::parking_lot::ParkResult"]},{"text":"impl PartialEq<UnparkResult> for UnparkResult","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkResult"]},{"text":"impl PartialEq<RequeueOp> for RequeueOp","synthetic":false,"types":["parking_lot_core::parking_lot::RequeueOp"]},{"text":"impl PartialEq<FilterOp> for FilterOp","synthetic":false,"types":["parking_lot_core::parking_lot::FilterOp"]},{"text":"impl PartialEq<UnparkToken> for UnparkToken","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkToken"]},{"text":"impl PartialEq<ParkToken> for ParkToken","synthetic":false,"types":["parking_lot_core::parking_lot::ParkToken"]}]; implementors["parser"] = [{"text":"impl<'input> PartialEq<Token<'input>> for Token<'input>","synthetic":false,"types":["parser::queries::__intern_token::Token"]}]; implementors["proc_macro2"] = [{"text":"impl PartialEq<Delimiter> for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl PartialEq<Spacing> for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]},{"text":"impl PartialEq<Ident> for Ident","synthetic":false,"types":["proc_macro2::Ident"]},{"text":"impl<T: ?Sized> PartialEq<T> for Ident where
    T: AsRef<str>, 
","synthetic":false,"types":["proc_macro2::Ident"]}]; -implementors["rand"] = [{"text":"impl PartialEq<BernoulliError> for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl PartialEq<WeightedError> for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl PartialEq<IndexVec> for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]}]; +implementors["rand"] = [{"text":"impl PartialEq<WeightedError> for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl PartialEq<IndexVec> for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]}]; implementors["rand_core"] = [{"text":"impl PartialEq<ErrorKind> for ErrorKind","synthetic":false,"types":["rand_core::error::ErrorKind"]}]; implementors["rand_jitter"] = [{"text":"impl PartialEq<TimerError> for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":["regex::error::Error"]},{"text":"impl<'t> PartialEq<Match<'t>> for Match<'t>","synthetic":false,"types":["regex::re_bytes::Match"]},{"text":"impl<'t> PartialEq<Match<'t>> for Match<'t>","synthetic":false,"types":["regex::re_unicode::Match"]}]; diff --git a/implementors/core/fmt/trait.Debug.js b/implementors/core/fmt/trait.Debug.js index 728934d..a54c20f 100644 --- a/implementors/core/fmt/trait.Debug.js +++ b/implementors/core/fmt/trait.Debug.js @@ -65,7 +65,7 @@ implementors["parser"] = [{"text":"impl<'input> Debug for PercentDecode<'a>","synthetic":false,"types":["percent_encoding::PercentDecode"]}]; implementors["proc_macro2"] = [{"text":"impl Debug for TokenStream","synthetic":false,"types":["proc_macro2::TokenStream"]},{"text":"impl Debug for LexError","synthetic":false,"types":["proc_macro2::LexError"]},{"text":"impl Debug for Span","synthetic":false,"types":["proc_macro2::Span"]},{"text":"impl Debug for TokenTree","synthetic":false,"types":["proc_macro2::TokenTree"]},{"text":"impl Debug for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl Debug for Group","synthetic":false,"types":["proc_macro2::Group"]},{"text":"impl Debug for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]},{"text":"impl Debug for Punct","synthetic":false,"types":["proc_macro2::Punct"]},{"text":"impl Debug for Ident","synthetic":false,"types":["proc_macro2::Ident"]},{"text":"impl Debug for Literal","synthetic":false,"types":["proc_macro2::Literal"]},{"text":"impl Debug for IntoIter","synthetic":false,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X: Debug, E: Debug> Debug for Context<X, E>","synthetic":false,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl Debug for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Debug for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Debug for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Debug for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Debug for Dirichlet","synthetic":false,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Debug for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Debug for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Debug for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Debug for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Debug for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Debug for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Debug for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Debug for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Debug for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Debug for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Debug for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Debug for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Debug for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Debug> Debug for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Debug> Debug for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Debug for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Debug for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Debug for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Debug for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<W: Weight> Debug for WeightedIndex<W> where
    W: Debug,
    Uniform<W>: Debug
","synthetic":false,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl<X: Debug + SampleUniform + PartialOrd> Debug for WeightedIndex<X> where
    X::Sampler: Debug
","synthetic":false,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Debug for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Debug for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Debug for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Debug for Alphanumeric","synthetic":false,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<D: Debug, R: Debug, T: Debug> Debug for DistIter<D, R, T>","synthetic":false,"types":["rand::distributions::DistIter"]},{"text":"impl Debug for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl<R: Debug> Debug for ReadRng<R>","synthetic":false,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl Debug for ReadError","synthetic":false,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R: Debug, Rsdr: Debug> Debug for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Debug for EntropyRng","synthetic":false,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Debug for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl Debug for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl Debug for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Debug for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Debug for IndexVecIter<'a>","synthetic":false,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Debug for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]},{"text":"impl<'a, S: Debug + ?Sized + 'a, T: Debug + 'a> Debug for SliceChooseIter<'a, S, T>","synthetic":false,"types":["rand::seq::SliceChooseIter"]}]; +implementors["rand"] = [{"text":"impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Debug> Debug for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Debug> Debug for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Debug for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Debug for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X: Debug + SampleUniform + PartialOrd> Debug for WeightedIndex<X> where
    X::Sampler: Debug
","synthetic":false,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Debug for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Debug for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Debug for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Debug for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Debug for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Debug for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Debug for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Debug for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Debug for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Debug for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Debug for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Debug for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Debug for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Debug for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Debug for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Debug for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Debug for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Debug for Dirichlet","synthetic":false,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Debug for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Debug for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl Debug for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Debug for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Debug for Alphanumeric","synthetic":false,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<'a, D: Debug + 'a, R: Debug + 'a, T: Debug> Debug for DistIter<'a, D, R, T>","synthetic":false,"types":["rand::distributions::DistIter"]},{"text":"impl Debug for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl<T: Debug> Debug for Weighted<T>","synthetic":false,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T: Debug + 'a> Debug for WeightedChoice<'a, T>","synthetic":false,"types":["rand::distributions::WeightedChoice"]},{"text":"impl<R: Debug> Debug for ReadRng<R>","synthetic":false,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R: Debug, Rsdr: Debug> Debug for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Debug for EntropyRng","synthetic":false,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Debug for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl Debug for SmallRng","synthetic":false,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Debug for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl Debug for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Debug for IndexVec","synthetic":false,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Debug for IndexVecIter<'a>","synthetic":false,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Debug for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]},{"text":"impl<'a, S: Debug + ?Sized + 'a, T: Debug + 'a> Debug for SliceChooseIter<'a, S, T>","synthetic":false,"types":["rand::seq::SliceChooseIter"]}]; implementors["rand_chacha"] = [{"text":"impl Debug for ChaCha20Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Debug for ChaCha20Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Debug for ChaCha12Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Debug for ChaCha12Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Debug for ChaCha8Core","synthetic":false,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Debug for ChaCha8Rng","synthetic":false,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl Debug for Error","synthetic":false,"types":["rand_core::error::Error"]},{"text":"impl<R: BlockRngCore + Debug> Debug for BlockRng<R>","synthetic":false,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: BlockRngCore + Debug> Debug for BlockRng64<R>","synthetic":false,"types":["rand_core::block::BlockRng64"]},{"text":"impl Debug for OsRng","synthetic":false,"types":["rand_core::os::OsRng"]}]; implementors["rand_hc"] = [{"text":"impl Debug for Hc128Rng","synthetic":false,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Debug for Hc128Core","synthetic":false,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/core/fmt/trait.Display.js b/implementors/core/fmt/trait.Display.js index cb6875e..6f20247 100644 --- a/implementors/core/fmt/trait.Display.js +++ b/implementors/core/fmt/trait.Display.js @@ -35,7 +35,7 @@ implementors["num_traits"] = [{"text":"impl Display for Token<'a>","synthetic":false,"types":["parser::queries::__intern_token::Token"]}]; implementors["percent_encoding"] = [{"text":"impl<'a> Display for PercentEncode<'a>","synthetic":false,"types":["percent_encoding::PercentEncode"]}]; implementors["proc_macro2"] = [{"text":"impl Display for TokenStream","synthetic":false,"types":["proc_macro2::TokenStream"]},{"text":"impl Display for TokenTree","synthetic":false,"types":["proc_macro2::TokenTree"]},{"text":"impl Display for Group","synthetic":false,"types":["proc_macro2::Group"]},{"text":"impl Display for Punct","synthetic":false,"types":["proc_macro2::Punct"]},{"text":"impl Display for Ident","synthetic":false,"types":["proc_macro2::Ident"]},{"text":"impl Display for Literal","synthetic":false,"types":["proc_macro2::Literal"]}]; -implementors["rand"] = [{"text":"impl Display for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Display for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Display for ReadError","synthetic":false,"types":["rand::rngs::adapter::read::ReadError"]}]; +implementors["rand"] = [{"text":"impl Display for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; implementors["rand_core"] = [{"text":"impl Display for Error","synthetic":false,"types":["rand_core::error::Error"]}]; implementors["rand_jitter"] = [{"text":"impl Display for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl Display for Error","synthetic":false,"types":["regex::error::Error"]},{"text":"impl Display for Regex","synthetic":false,"types":["regex::re_bytes::Regex"]},{"text":"impl Display for Regex","synthetic":false,"types":["regex::re_unicode::Regex"]}]; diff --git a/implementors/core/iter/traits/iterator/trait.Iterator.js b/implementors/core/iter/traits/iterator/trait.Iterator.js index a3aa385..5c7ef2b 100644 --- a/implementors/core/iter/traits/iterator/trait.Iterator.js +++ b/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -19,7 +19,7 @@ implementors["mio"] = [{"text":"impl<'a> Iterator for IterBinomial<T> where
    T: Integer + Clone
","synthetic":false,"types":["num_integer::IterBinomial"]}]; implementors["percent_encoding"] = [{"text":"impl<'a> Iterator for PercentEncode<'a>","synthetic":false,"types":["percent_encoding::PercentEncode"]},{"text":"impl<'a> Iterator for PercentDecode<'a>","synthetic":false,"types":["percent_encoding::PercentDecode"]}]; implementors["proc_macro2"] = [{"text":"impl Iterator for IntoIter","synthetic":false,"types":["proc_macro2::token_stream::IntoIter"]}]; -implementors["rand"] = [{"text":"impl<D, R, T> Iterator for DistIter<D, R, T> where
    D: Distribution<T>,
    R: Rng
","synthetic":false,"types":["rand::distributions::DistIter"]},{"text":"impl<'a> Iterator for IndexVecIter<'a>","synthetic":false,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Iterator for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]},{"text":"impl<'a, S: Index<usize, Output = T> + ?Sized + 'a, T: 'a> Iterator for SliceChooseIter<'a, S, T>","synthetic":false,"types":["rand::seq::SliceChooseIter"]}]; +implementors["rand"] = [{"text":"impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
    D: Distribution<T>,
    R: Rng + 'a, 
","synthetic":false,"types":["rand::distributions::DistIter"]},{"text":"impl<'a> Iterator for IndexVecIter<'a>","synthetic":false,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Iterator for IndexVecIntoIter","synthetic":false,"types":["rand::seq::index::IndexVecIntoIter"]},{"text":"impl<'a, S: Index<usize, Output = T> + ?Sized + 'a, T: 'a> Iterator for SliceChooseIter<'a, S, T>","synthetic":false,"types":["rand::seq::SliceChooseIter"]}]; implementors["regex"] = [{"text":"impl<'r, 't> Iterator for Matches<'r, 't>","synthetic":false,"types":["regex::re_bytes::Matches"]},{"text":"impl<'r, 't> Iterator for CaptureMatches<'r, 't>","synthetic":false,"types":["regex::re_bytes::CaptureMatches"]},{"text":"impl<'r, 't> Iterator for Split<'r, 't>","synthetic":false,"types":["regex::re_bytes::Split"]},{"text":"impl<'r, 't> Iterator for SplitN<'r, 't>","synthetic":false,"types":["regex::re_bytes::SplitN"]},{"text":"impl<'r> Iterator for CaptureNames<'r>","synthetic":false,"types":["regex::re_bytes::CaptureNames"]},{"text":"impl<'c, 't> Iterator for SubCaptureMatches<'c, 't>","synthetic":false,"types":["regex::re_bytes::SubCaptureMatches"]},{"text":"impl Iterator for SetMatchesIntoIter","synthetic":false,"types":["regex::re_set::unicode::SetMatchesIntoIter"]},{"text":"impl<'a> Iterator for SetMatchesIter<'a>","synthetic":false,"types":["regex::re_set::unicode::SetMatchesIter"]},{"text":"impl Iterator for SetMatchesIntoIter","synthetic":false,"types":["regex::re_set::bytes::SetMatchesIntoIter"]},{"text":"impl<'a> Iterator for SetMatchesIter<'a>","synthetic":false,"types":["regex::re_set::bytes::SetMatchesIter"]},{"text":"impl<'r> Iterator for CaptureNames<'r>","synthetic":false,"types":["regex::re_unicode::CaptureNames"]},{"text":"impl<'r, 't> Iterator for Split<'r, 't>","synthetic":false,"types":["regex::re_unicode::Split"]},{"text":"impl<'r, 't> Iterator for SplitN<'r, 't>","synthetic":false,"types":["regex::re_unicode::SplitN"]},{"text":"impl<'c, 't> Iterator for SubCaptureMatches<'c, 't>","synthetic":false,"types":["regex::re_unicode::SubCaptureMatches"]},{"text":"impl<'r, 't> Iterator for CaptureMatches<'r, 't>","synthetic":false,"types":["regex::re_unicode::CaptureMatches"]},{"text":"impl<'r, 't> Iterator for Matches<'r, 't>","synthetic":false,"types":["regex::re_unicode::Matches"]}]; implementors["regex_syntax"] = [{"text":"impl<'a> Iterator for ClassUnicodeIter<'a>","synthetic":false,"types":["regex_syntax::hir::ClassUnicodeIter"]},{"text":"impl<'a> Iterator for ClassBytesIter<'a>","synthetic":false,"types":["regex_syntax::hir::ClassBytesIter"]},{"text":"impl Iterator for Utf8Sequences","synthetic":false,"types":["regex_syntax::utf8::Utf8Sequences"]}]; implementors["resolv_conf"] = [{"text":"impl<'a> Iterator for DomainIter<'a>","synthetic":false,"types":["resolv_conf::config::DomainIter"]}]; diff --git a/implementors/core/iter/traits/marker/trait.FusedIterator.js b/implementors/core/iter/traits/marker/trait.FusedIterator.js index 6479ae5..368984d 100644 --- a/implementors/core/iter/traits/marker/trait.FusedIterator.js +++ b/implementors/core/iter/traits/marker/trait.FusedIterator.js @@ -1,6 +1,6 @@ (function() {var implementors = {}; implementors["hashbrown"] = [{"text":"impl<'_, K, V> FusedIterator for Iter<'_, K, V>","synthetic":false,"types":["hashbrown::map::Iter"]},{"text":"impl<'_, K, V> FusedIterator for IterMut<'_, K, V>","synthetic":false,"types":["hashbrown::map::IterMut"]},{"text":"impl<K, V> FusedIterator for IntoIter<K, V>","synthetic":false,"types":["hashbrown::map::IntoIter"]},{"text":"impl<'_, K, V> FusedIterator for Keys<'_, K, V>","synthetic":false,"types":["hashbrown::map::Keys"]},{"text":"impl<'_, K, V> FusedIterator for Values<'_, K, V>","synthetic":false,"types":["hashbrown::map::Values"]},{"text":"impl<'_, K, V> FusedIterator for ValuesMut<'_, K, V>","synthetic":false,"types":["hashbrown::map::ValuesMut"]},{"text":"impl<'_, K, V> FusedIterator for Drain<'_, K, V>","synthetic":false,"types":["hashbrown::map::Drain"]},{"text":"impl<'_, K> FusedIterator for Iter<'_, K>","synthetic":false,"types":["hashbrown::set::Iter"]},{"text":"impl<K> FusedIterator for IntoIter<K>","synthetic":false,"types":["hashbrown::set::IntoIter"]},{"text":"impl<'_, K> FusedIterator for Drain<'_, K>","synthetic":false,"types":["hashbrown::set::Drain"]},{"text":"impl<'_, T, S> FusedIterator for Intersection<'_, T, S> where
    T: Eq + Hash,
    S: BuildHasher
","synthetic":false,"types":["hashbrown::set::Intersection"]},{"text":"impl<'_, T, S> FusedIterator for Difference<'_, T, S> where
    T: Eq + Hash,
    S: BuildHasher
","synthetic":false,"types":["hashbrown::set::Difference"]},{"text":"impl<'_, T, S> FusedIterator for SymmetricDifference<'_, T, S> where
    T: Eq + Hash,
    S: BuildHasher
","synthetic":false,"types":["hashbrown::set::SymmetricDifference"]},{"text":"impl<'_, T, S> FusedIterator for Union<'_, T, S> where
    T: Eq + Hash,
    S: BuildHasher
","synthetic":false,"types":["hashbrown::set::Union"]}]; implementors["mime_guess"] = [{"text":"impl FusedIterator for Iter","synthetic":false,"types":["mime_guess::Iter"]},{"text":"impl FusedIterator for IterRaw","synthetic":false,"types":["mime_guess::IterRaw"]}]; -implementors["rand"] = [{"text":"impl<D, R, T> FusedIterator for DistIter<D, R, T> where
    D: Distribution<T>,
    R: Rng
","synthetic":false,"types":["rand::distributions::DistIter"]}]; +implementors["rand"] = [{"text":"impl<'a, D, R, T> FusedIterator for DistIter<'a, D, R, T> where
    D: Distribution<T>,
    R: Rng + 'a, 
","synthetic":false,"types":["rand::distributions::DistIter"]}]; implementors["smallvec"] = [{"text":"impl<'a, T: Array> FusedIterator for Drain<'a, T>","synthetic":false,"types":["smallvec::Drain"]},{"text":"impl<A: Array> FusedIterator for IntoIter<A>","synthetic":false,"types":["smallvec::IntoIter"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/core/marker/trait.Copy.js b/implementors/core/marker/trait.Copy.js index 6686f60..fe1f89a 100644 --- a/implementors/core/marker/trait.Copy.js +++ b/implementors/core/marker/trait.Copy.js @@ -38,7 +38,7 @@ implementors["parking_lot_core"] = [{"text":"impl Copy for SIMPLE_ENCODE_SET","synthetic":false,"types":["percent_encoding::SIMPLE_ENCODE_SET"]},{"text":"impl Copy for QUERY_ENCODE_SET","synthetic":false,"types":["percent_encoding::QUERY_ENCODE_SET"]},{"text":"impl Copy for DEFAULT_ENCODE_SET","synthetic":false,"types":["percent_encoding::DEFAULT_ENCODE_SET"]},{"text":"impl Copy for PATH_SEGMENT_ENCODE_SET","synthetic":false,"types":["percent_encoding::PATH_SEGMENT_ENCODE_SET"]},{"text":"impl Copy for USERINFO_ENCODE_SET","synthetic":false,"types":["percent_encoding::USERINFO_ENCODE_SET"]}]; implementors["ppv_lite86"] = [{"text":"impl Copy for YesS3","synthetic":false,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Copy for NoS3","synthetic":false,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Copy for YesS4","synthetic":false,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Copy for NoS4","synthetic":false,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Copy for YesA1","synthetic":false,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Copy for NoA1","synthetic":false,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Copy for YesA2","synthetic":false,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Copy for NoA2","synthetic":false,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Copy for YesNI","synthetic":false,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Copy for NoNI","synthetic":false,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3: Copy, S4: Copy, NI: Copy> Copy for SseMachine<S3, S4, NI>","synthetic":false,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI: Copy> Copy for Avx2Machine<NI>","synthetic":false,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Copy for vec128_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Copy for vec256_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Copy for vec512_storage","synthetic":false,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl Copy for Span","synthetic":false,"types":["proc_macro2::Span"]},{"text":"impl Copy for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl Copy for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]}]; -implementors["rand"] = [{"text":"impl Copy for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Copy for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Copy for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Copy for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Copy for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Copy for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Copy for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Copy for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Copy for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Copy for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Copy for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Copy for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Copy for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Copy for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Copy for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Copy for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Copy for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Copy> Copy for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Copy> Copy for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Copy for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Copy for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Copy for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Copy for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl Copy for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Copy for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Copy for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Copy for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl Copy for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]}]; +implementors["rand"] = [{"text":"impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
","synthetic":false,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl<X: Copy> Copy for UniformInt<X>","synthetic":false,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X: Copy> Copy for UniformFloat<X>","synthetic":false,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Copy for UniformDuration","synthetic":false,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Copy for Bernoulli","synthetic":false,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Copy for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Copy for UnitSphereSurface","synthetic":false,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Copy for UnitCircle","synthetic":false,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Copy for Gamma","synthetic":false,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Copy for ChiSquared","synthetic":false,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Copy for FisherF","synthetic":false,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Copy for StudentT","synthetic":false,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Copy for Beta","synthetic":false,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Copy for StandardNormal","synthetic":false,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Copy for Normal","synthetic":false,"types":["rand::distributions::normal::Normal"]},{"text":"impl Copy for LogNormal","synthetic":false,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Copy for Exp1","synthetic":false,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Copy for Exp","synthetic":false,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Copy for Pareto","synthetic":false,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Copy for Poisson","synthetic":false,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Copy for Binomial","synthetic":false,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Copy for Cauchy","synthetic":false,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Copy for Triangular","synthetic":false,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Copy for Weibull","synthetic":false,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl Copy for OpenClosed01","synthetic":false,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Copy for Open01","synthetic":false,"types":["rand::distributions::float::Open01"]},{"text":"impl Copy for Standard","synthetic":false,"types":["rand::distributions::Standard"]},{"text":"impl<T: Copy> Copy for Weighted<T>","synthetic":false,"types":["rand::distributions::Weighted"]}]; implementors["rand_core"] = [{"text":"impl Copy for OsRng","synthetic":false,"types":["rand_core::os::OsRng"]}]; implementors["regex"] = [{"text":"impl<'t> Copy for Match<'t>","synthetic":false,"types":["regex::re_bytes::Match"]},{"text":"impl<'t> Copy for Match<'t>","synthetic":false,"types":["regex::re_unicode::Match"]}]; implementors["regex_syntax"] = [{"text":"impl Copy for Span","synthetic":false,"types":["regex_syntax::ast::Span"]},{"text":"impl Copy for Position","synthetic":false,"types":["regex_syntax::ast::Position"]},{"text":"impl Copy for ClassSetBinaryOpKind","synthetic":false,"types":["regex_syntax::ast::ClassSetBinaryOpKind"]},{"text":"impl Copy for Flag","synthetic":false,"types":["regex_syntax::ast::Flag"]},{"text":"impl Copy for ClassUnicodeRange","synthetic":false,"types":["regex_syntax::hir::ClassUnicodeRange"]},{"text":"impl Copy for ClassBytesRange","synthetic":false,"types":["regex_syntax::hir::ClassBytesRange"]},{"text":"impl Copy for Utf8Sequence","synthetic":false,"types":["regex_syntax::utf8::Utf8Sequence"]},{"text":"impl Copy for Utf8Range","synthetic":false,"types":["regex_syntax::utf8::Utf8Range"]}]; diff --git a/implementors/core/marker/trait.Freeze.js b/implementors/core/marker/trait.Freeze.js index 100184d..00a4079 100644 --- a/implementors/core/marker/trait.Freeze.js +++ b/implementors/core/marker/trait.Freeze.js @@ -78,7 +78,7 @@ implementors["percent_encoding"] = [{"text":"impl Freeze for YesS3","synthetic":true,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Freeze for NoS3","synthetic":true,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Freeze for YesS4","synthetic":true,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Freeze for NoS4","synthetic":true,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Freeze for YesA1","synthetic":true,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Freeze for NoA1","synthetic":true,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Freeze for YesA2","synthetic":true,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Freeze for NoA2","synthetic":true,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Freeze for YesNI","synthetic":true,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Freeze for NoNI","synthetic":true,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3, S4, NI> Freeze for SseMachine<S3, S4, NI>","synthetic":true,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI> Freeze for Avx2Machine<NI>","synthetic":true,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Freeze for vec128_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Freeze for vec256_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Freeze for vec512_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl Freeze for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl Freeze for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl Freeze for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl Freeze for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl Freeze for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl Freeze for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl Freeze for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl Freeze for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl Freeze for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl Freeze for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl Freeze for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> Freeze for Context<X, E> where
    E: Freeze,
    X: Freeze, 
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl Freeze for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Freeze for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Freeze for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Freeze for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Freeze for Uniform<X> where
    <X as SampleUniform>::Sampler: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Freeze for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Freeze for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Freeze for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Freeze for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Freeze for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Freeze for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Freeze for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Freeze for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Freeze for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Freeze for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Freeze for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Freeze for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Freeze for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Freeze for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Freeze for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Freeze for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Freeze for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Freeze for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Freeze for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> Freeze for DistIter<D, R, T> where
    D: Freeze,
    R: Freeze, 
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Freeze for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl Freeze for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> Freeze for UniformInt<X> where
    X: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Freeze for UniformFloat<X> where
    X: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Freeze for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> Freeze for WeightedIndex<X> where
    X: Freeze,
    <X as SampleUniform>::Sampler: Freeze, 
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Freeze for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> Freeze for WeightedIndex<W> where
    <W as SampleUniform>::Sampler: Freeze, 
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl Freeze for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Freeze for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl Freeze for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Freeze for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> Freeze for ReadRng<R> where
    R: Freeze, 
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Freeze for ReseedingRng<R, Rsdr> where
    R: Freeze,
    Rsdr: Freeze,
    <R as BlockRngCore>::Results: Freeze, 
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Freeze for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Freeze for SliceChooseIter<'a, S, T>","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Freeze for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Freeze for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Freeze for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl Freeze for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Freeze for Uniform<X> where
    <X as SampleUniform>::Sampler: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Freeze for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Freeze for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Freeze for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> Freeze for WeightedIndex<X> where
    <X as SampleUniform>::Sampler: Freeze, 
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Freeze for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Freeze for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Freeze for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Freeze for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Freeze for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Freeze for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Freeze for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Freeze for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Freeze for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Freeze for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Freeze for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Freeze for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Freeze for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Freeze for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Freeze for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Freeze for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Freeze for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Freeze for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Freeze for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> Freeze for DistIter<'a, D, R, T>","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Freeze for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> Freeze for Weighted<T> where
    T: Freeze, 
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> Freeze for WeightedChoice<'a, T>","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl Freeze for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> Freeze for UniformInt<X> where
    X: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Freeze for UniformFloat<X> where
    X: Freeze, 
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Freeze for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Freeze for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Freeze for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Freeze for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl Freeze for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> Freeze for ReadRng<R> where
    R: Freeze, 
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Freeze for ReseedingRng<R, Rsdr> where
    R: Freeze,
    Rsdr: Freeze,
    <R as BlockRngCore>::Results: Freeze, 
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Freeze for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Freeze for SliceChooseIter<'a, S, T>","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Freeze for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Freeze for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Freeze for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl Freeze for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Freeze for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Freeze for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Freeze for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Freeze for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Freeze for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl Freeze for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> Freeze for BlockRng<R> where
    R: Freeze,
    <R as BlockRngCore>::Results: Freeze, 
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> Freeze for BlockRng64<R> where
    R: Freeze,
    <R as BlockRngCore>::Results: Freeze, 
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl Freeze for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Freeze for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/core/marker/trait.Send.js b/implementors/core/marker/trait.Send.js index e589f49..39f0fb9 100644 --- a/implementors/core/marker/trait.Send.js +++ b/implementors/core/marker/trait.Send.js @@ -77,7 +77,7 @@ implementors["percent_encoding"] = [{"text":"impl Send for YesS3","synthetic":true,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Send for NoS3","synthetic":true,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Send for YesS4","synthetic":true,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Send for NoS4","synthetic":true,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Send for YesA1","synthetic":true,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Send for NoA1","synthetic":true,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Send for YesA2","synthetic":true,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Send for NoA2","synthetic":true,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Send for YesNI","synthetic":true,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Send for NoNI","synthetic":true,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3, S4, NI> Send for SseMachine<S3, S4, NI> where
    NI: Send,
    S3: Send,
    S4: Send
","synthetic":true,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI> Send for Avx2Machine<NI> where
    NI: Send
","synthetic":true,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Send for vec128_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Send for vec256_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Send for vec512_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl !Send for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl !Send for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl !Send for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl !Send for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl !Send for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl !Send for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl !Send for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl !Send for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl Send for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl Send for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl !Send for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> Send for Context<X, E> where
    E: Send,
    X: Send
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl Send for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Send for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Send for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Send for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Send for Uniform<X> where
    <X as SampleUniform>::Sampler: Send
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Send for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Send for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Send for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Send for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Send for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Send for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Send for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Send for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Send for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Send for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Send for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Send for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Send for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Send for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Send for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Send for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Send for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Send for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Send for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> Send for DistIter<D, R, T> where
    D: Send,
    R: Send,
    T: Send
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Send for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl Send for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> Send for UniformInt<X> where
    X: Send
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Send for UniformFloat<X> where
    X: Send
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Send for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> Send for WeightedIndex<X> where
    X: Send,
    <X as SampleUniform>::Sampler: Send
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Send for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> Send for WeightedIndex<W> where
    W: Send,
    <W as SampleUniform>::Sampler: Send
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl Send for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Send for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl !Send for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Send for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> Send for ReadRng<R> where
    R: Send
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Send for ReseedingRng<R, Rsdr> where
    R: Send,
    Rsdr: Send,
    <R as BlockRngCore>::Results: Send
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Send for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Send for SliceChooseIter<'a, S, T> where
    S: Sync,
    T: Send
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Send for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Send for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Send for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl Send for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Send for Uniform<X> where
    <X as SampleUniform>::Sampler: Send
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Send for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Send for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Send for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> Send for WeightedIndex<X> where
    X: Send,
    <X as SampleUniform>::Sampler: Send
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Send for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Send for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Send for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Send for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Send for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Send for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Send for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Send for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Send for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Send for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Send for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Send for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Send for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Send for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Send for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Send for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Send for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Send for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Send for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> Send for DistIter<'a, D, R, T> where
    D: Sync,
    R: Send,
    T: Send
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Send for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> Send for Weighted<T> where
    T: Send
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> Send for WeightedChoice<'a, T> where
    T: Send
","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl Send for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> Send for UniformInt<X> where
    X: Send
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Send for UniformFloat<X> where
    X: Send
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Send for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Send for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Send for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Send for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl !Send for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> Send for ReadRng<R> where
    R: Send
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Send for ReseedingRng<R, Rsdr> where
    R: Send,
    Rsdr: Send,
    <R as BlockRngCore>::Results: Send
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Send for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Send for SliceChooseIter<'a, S, T> where
    S: Sync,
    T: Send
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Send for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Send for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Send for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl Send for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Send for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Send for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Send for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Send for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Send for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl Send for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl Send for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> Send for BlockRng<R> where
    R: Send,
    <R as BlockRngCore>::Results: Send
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> Send for BlockRng64<R> where
    R: Send,
    <R as BlockRngCore>::Results: Send
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl Send for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Send for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/core/marker/trait.StructuralEq.js b/implementors/core/marker/trait.StructuralEq.js index 6fc2452..2f0213e 100644 --- a/implementors/core/marker/trait.StructuralEq.js +++ b/implementors/core/marker/trait.StructuralEq.js @@ -38,7 +38,7 @@ implementors["parking_lot"] = [{"text":"impl StructuralEq for ParkResult","synthetic":false,"types":["parking_lot_core::parking_lot::ParkResult"]},{"text":"impl StructuralEq for UnparkResult","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkResult"]},{"text":"impl StructuralEq for RequeueOp","synthetic":false,"types":["parking_lot_core::parking_lot::RequeueOp"]},{"text":"impl StructuralEq for FilterOp","synthetic":false,"types":["parking_lot_core::parking_lot::FilterOp"]},{"text":"impl StructuralEq for UnparkToken","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkToken"]},{"text":"impl StructuralEq for ParkToken","synthetic":false,"types":["parking_lot_core::parking_lot::ParkToken"]}]; implementors["parser"] = [{"text":"impl<'input> StructuralEq for Token<'input>","synthetic":false,"types":["parser::queries::__intern_token::Token"]}]; implementors["proc_macro2"] = [{"text":"impl StructuralEq for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl StructuralEq for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]}]; -implementors["rand"] = [{"text":"impl StructuralEq for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl StructuralEq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; +implementors["rand"] = [{"text":"impl StructuralEq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; implementors["rand_core"] = [{"text":"impl StructuralEq for ErrorKind","synthetic":false,"types":["rand_core::error::ErrorKind"]}]; implementors["rand_jitter"] = [{"text":"impl StructuralEq for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl<'t> StructuralEq for Match<'t>","synthetic":false,"types":["regex::re_bytes::Match"]},{"text":"impl<'t> StructuralEq for Match<'t>","synthetic":false,"types":["regex::re_unicode::Match"]}]; diff --git a/implementors/core/marker/trait.StructuralPartialEq.js b/implementors/core/marker/trait.StructuralPartialEq.js index b09b612..8b0ab94 100644 --- a/implementors/core/marker/trait.StructuralPartialEq.js +++ b/implementors/core/marker/trait.StructuralPartialEq.js @@ -38,7 +38,7 @@ implementors["parking_lot"] = [{"text":"impl StructuralPartialEq for ParkResult","synthetic":false,"types":["parking_lot_core::parking_lot::ParkResult"]},{"text":"impl StructuralPartialEq for UnparkResult","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkResult"]},{"text":"impl StructuralPartialEq for RequeueOp","synthetic":false,"types":["parking_lot_core::parking_lot::RequeueOp"]},{"text":"impl StructuralPartialEq for FilterOp","synthetic":false,"types":["parking_lot_core::parking_lot::FilterOp"]},{"text":"impl StructuralPartialEq for UnparkToken","synthetic":false,"types":["parking_lot_core::parking_lot::UnparkToken"]},{"text":"impl StructuralPartialEq for ParkToken","synthetic":false,"types":["parking_lot_core::parking_lot::ParkToken"]}]; implementors["parser"] = [{"text":"impl<'input> StructuralPartialEq for Token<'input>","synthetic":false,"types":["parser::queries::__intern_token::Token"]}]; implementors["proc_macro2"] = [{"text":"impl StructuralPartialEq for Delimiter","synthetic":false,"types":["proc_macro2::Delimiter"]},{"text":"impl StructuralPartialEq for Spacing","synthetic":false,"types":["proc_macro2::Spacing"]}]; -implementors["rand"] = [{"text":"impl StructuralPartialEq for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl StructuralPartialEq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; +implementors["rand"] = [{"text":"impl StructuralPartialEq for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; implementors["rand_core"] = [{"text":"impl StructuralPartialEq for ErrorKind","synthetic":false,"types":["rand_core::error::ErrorKind"]}]; implementors["rand_jitter"] = [{"text":"impl StructuralPartialEq for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":["regex::error::Error"]},{"text":"impl<'t> StructuralPartialEq for Match<'t>","synthetic":false,"types":["regex::re_bytes::Match"]},{"text":"impl<'t> StructuralPartialEq for Match<'t>","synthetic":false,"types":["regex::re_unicode::Match"]}]; diff --git a/implementors/core/marker/trait.Sync.js b/implementors/core/marker/trait.Sync.js index ffa33ac..82cc4db 100644 --- a/implementors/core/marker/trait.Sync.js +++ b/implementors/core/marker/trait.Sync.js @@ -77,7 +77,7 @@ implementors["percent_encoding"] = [{"text":"impl Sync for YesS3","synthetic":true,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Sync for NoS3","synthetic":true,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Sync for YesS4","synthetic":true,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Sync for NoS4","synthetic":true,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Sync for YesA1","synthetic":true,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Sync for NoA1","synthetic":true,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Sync for YesA2","synthetic":true,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Sync for NoA2","synthetic":true,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Sync for YesNI","synthetic":true,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Sync for NoNI","synthetic":true,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3, S4, NI> Sync for SseMachine<S3, S4, NI> where
    NI: Sync,
    S3: Sync,
    S4: Sync
","synthetic":true,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI> Sync for Avx2Machine<NI> where
    NI: Sync
","synthetic":true,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Sync for vec128_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Sync for vec256_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Sync for vec512_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl !Sync for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl !Sync for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl !Sync for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl !Sync for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl !Sync for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl !Sync for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl !Sync for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl !Sync for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl Sync for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl Sync for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl !Sync for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> Sync for Context<X, E> where
    E: Sync,
    X: Sync
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl Sync for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Sync for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Sync for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Sync for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Sync for Uniform<X> where
    <X as SampleUniform>::Sampler: Sync
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Sync for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Sync for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Sync for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Sync for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Sync for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Sync for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Sync for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Sync for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Sync for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Sync for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Sync for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Sync for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Sync for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Sync for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Sync for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Sync for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Sync for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Sync for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Sync for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> Sync for DistIter<D, R, T> where
    D: Sync,
    R: Sync,
    T: Sync
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Sync for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl Sync for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> Sync for UniformInt<X> where
    X: Sync
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Sync for UniformFloat<X> where
    X: Sync
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Sync for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> Sync for WeightedIndex<X> where
    X: Sync,
    <X as SampleUniform>::Sampler: Sync
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Sync for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> Sync for WeightedIndex<W> where
    W: Sync,
    <W as SampleUniform>::Sampler: Sync
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl Sync for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Sync for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl !Sync for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Sync for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> Sync for ReadRng<R> where
    R: Sync
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Sync for ReseedingRng<R, Rsdr> where
    R: Sync,
    Rsdr: Sync,
    <R as BlockRngCore>::Results: Sync
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Sync for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Sync for SliceChooseIter<'a, S, T> where
    S: Sync,
    T: Sync
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Sync for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Sync for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Sync for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl Sync for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Sync for Uniform<X> where
    <X as SampleUniform>::Sampler: Sync
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Sync for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Sync for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Sync for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> Sync for WeightedIndex<X> where
    X: Sync,
    <X as SampleUniform>::Sampler: Sync
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Sync for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Sync for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Sync for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Sync for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Sync for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Sync for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Sync for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Sync for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Sync for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Sync for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Sync for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Sync for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Sync for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Sync for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Sync for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Sync for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Sync for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Sync for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Sync for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> Sync for DistIter<'a, D, R, T> where
    D: Sync,
    R: Sync,
    T: Sync
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Sync for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> Sync for Weighted<T> where
    T: Sync
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> Sync for WeightedChoice<'a, T> where
    T: Sync
","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl Sync for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> Sync for UniformInt<X> where
    X: Sync
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Sync for UniformFloat<X> where
    X: Sync
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Sync for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Sync for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Sync for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Sync for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl !Sync for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> Sync for ReadRng<R> where
    R: Sync
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Sync for ReseedingRng<R, Rsdr> where
    R: Sync,
    Rsdr: Sync,
    <R as BlockRngCore>::Results: Sync
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Sync for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Sync for SliceChooseIter<'a, S, T> where
    S: Sync,
    T: Sync
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Sync for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Sync for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Sync for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl Sync for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Sync for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Sync for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Sync for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Sync for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Sync for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl Sync for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl Sync for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> Sync for BlockRng<R> where
    R: Sync,
    <R as BlockRngCore>::Results: Sync
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> Sync for BlockRng64<R> where
    R: Sync,
    <R as BlockRngCore>::Results: Sync
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl Sync for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Sync for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/core/marker/trait.Unpin.js b/implementors/core/marker/trait.Unpin.js index 4ce15f6..ec24189 100644 --- a/implementors/core/marker/trait.Unpin.js +++ b/implementors/core/marker/trait.Unpin.js @@ -77,7 +77,7 @@ implementors["percent_encoding"] = [{"text":"impl Unpin for YesS3","synthetic":true,"types":["ppv_lite86::x86_64::YesS3"]},{"text":"impl Unpin for NoS3","synthetic":true,"types":["ppv_lite86::x86_64::NoS3"]},{"text":"impl Unpin for YesS4","synthetic":true,"types":["ppv_lite86::x86_64::YesS4"]},{"text":"impl Unpin for NoS4","synthetic":true,"types":["ppv_lite86::x86_64::NoS4"]},{"text":"impl Unpin for YesA1","synthetic":true,"types":["ppv_lite86::x86_64::YesA1"]},{"text":"impl Unpin for NoA1","synthetic":true,"types":["ppv_lite86::x86_64::NoA1"]},{"text":"impl Unpin for YesA2","synthetic":true,"types":["ppv_lite86::x86_64::YesA2"]},{"text":"impl Unpin for NoA2","synthetic":true,"types":["ppv_lite86::x86_64::NoA2"]},{"text":"impl Unpin for YesNI","synthetic":true,"types":["ppv_lite86::x86_64::YesNI"]},{"text":"impl Unpin for NoNI","synthetic":true,"types":["ppv_lite86::x86_64::NoNI"]},{"text":"impl<S3, S4, NI> Unpin for SseMachine<S3, S4, NI> where
    NI: Unpin,
    S3: Unpin,
    S4: Unpin
","synthetic":true,"types":["ppv_lite86::x86_64::SseMachine"]},{"text":"impl<NI> Unpin for Avx2Machine<NI> where
    NI: Unpin
","synthetic":true,"types":["ppv_lite86::x86_64::Avx2Machine"]},{"text":"impl Unpin for vec128_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec128_storage"]},{"text":"impl Unpin for vec256_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec256_storage"]},{"text":"impl Unpin for vec512_storage","synthetic":true,"types":["ppv_lite86::x86_64::vec512_storage"]}]; implementors["proc_macro2"] = [{"text":"impl Unpin for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl Unpin for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl Unpin for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl Unpin for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl Unpin for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl Unpin for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl Unpin for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl Unpin for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl Unpin for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl Unpin for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl Unpin for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> Unpin for Context<X, E> where
    E: Unpin,
    X: Unpin
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl Unpin for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl Unpin for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Unpin for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Unpin for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Unpin for Uniform<X> where
    <X as SampleUniform>::Sampler: Unpin
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Unpin for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Unpin for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Unpin for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Unpin for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Unpin for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Unpin for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Unpin for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Unpin for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Unpin for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Unpin for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Unpin for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Unpin for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Unpin for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Unpin for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Unpin for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Unpin for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Unpin for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Unpin for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Unpin for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> Unpin for DistIter<D, R, T> where
    D: Unpin,
    R: Unpin,
    T: Unpin
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Unpin for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl Unpin for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> Unpin for UniformInt<X> where
    X: Unpin
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Unpin for UniformFloat<X> where
    X: Unpin
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Unpin for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> Unpin for WeightedIndex<X> where
    X: Unpin,
    <X as SampleUniform>::Sampler: Unpin
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Unpin for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> Unpin for WeightedIndex<W> where
    W: Unpin,
    <W as SampleUniform>::Sampler: Unpin
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl Unpin for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Unpin for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl Unpin for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl Unpin for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> Unpin for ReadRng<R> where
    R: Unpin
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Unpin for ReseedingRng<R, Rsdr> where
    R: Unpin,
    Rsdr: Unpin,
    <R as BlockRngCore>::Results: Unpin
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Unpin for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Unpin for SliceChooseIter<'a, S, T> where
    T: Unpin
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Unpin for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Unpin for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Unpin for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl Unpin for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> Unpin for Uniform<X> where
    <X as SampleUniform>::Sampler: Unpin
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl Unpin for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl Unpin for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl Unpin for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> Unpin for WeightedIndex<X> where
    X: Unpin,
    <X as SampleUniform>::Sampler: Unpin
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl Unpin for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl Unpin for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl Unpin for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl Unpin for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl Unpin for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl Unpin for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl Unpin for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl Unpin for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl Unpin for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl Unpin for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl Unpin for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl Unpin for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl Unpin for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl Unpin for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl Unpin for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl Unpin for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl Unpin for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl Unpin for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl Unpin for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> Unpin for DistIter<'a, D, R, T> where
    T: Unpin
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl Unpin for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> Unpin for Weighted<T> where
    T: Unpin
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> Unpin for WeightedChoice<'a, T>","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl Unpin for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> Unpin for UniformInt<X> where
    X: Unpin
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> Unpin for UniformFloat<X> where
    X: Unpin
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl Unpin for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl Unpin for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl Unpin for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl Unpin for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl Unpin for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> Unpin for ReadRng<R> where
    R: Unpin
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> Unpin for ReseedingRng<R, Rsdr> where
    R: Unpin,
    Rsdr: Unpin,
    <R as BlockRngCore>::Results: Unpin
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl Unpin for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> Unpin for SliceChooseIter<'a, S, T> where
    T: Unpin
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl Unpin for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> Unpin for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl Unpin for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl Unpin for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl Unpin for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl Unpin for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl Unpin for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl Unpin for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl Unpin for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl Unpin for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> Unpin for BlockRng<R> where
    R: Unpin,
    <R as BlockRngCore>::Results: Unpin
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> Unpin for BlockRng64<R> where
    R: Unpin,
    <R as BlockRngCore>::Results: Unpin
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl Unpin for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl Unpin for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/rand/trait.RngCore.js b/implementors/rand/trait.RngCore.js index 92f7fd9..d149fd3 100644 --- a/implementors/rand/trait.RngCore.js +++ b/implementors/rand/trait.RngCore.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["rand"] = [{"text":"impl<R: Read> RngCore for ReadRng<R>","synthetic":false,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl RngCore for EntropyRng","synthetic":false,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl RngCore for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl RngCore for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl RngCore for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]}]; +implementors["rand"] = [{"text":"impl<R: Read> RngCore for ReadRng<R>","synthetic":false,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
","synthetic":false,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl RngCore for EntropyRng","synthetic":false,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl RngCore for StepRng","synthetic":false,"types":["rand::rngs::mock::StepRng"]},{"text":"impl RngCore for SmallRng","synthetic":false,"types":["rand::rngs::small::SmallRng"]},{"text":"impl RngCore for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]},{"text":"impl RngCore for ThreadRng","synthetic":false,"types":["rand::rngs::thread::ThreadRng"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/rand/trait.SeedableRng.js b/implementors/rand/trait.SeedableRng.js index 1e4669a..2cc39be 100644 --- a/implementors/rand/trait.SeedableRng.js +++ b/implementors/rand/trait.SeedableRng.js @@ -1,3 +1,3 @@ (function() {var implementors = {}; -implementors["rand"] = [{"text":"impl SeedableRng for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]}]; +implementors["rand"] = [{"text":"impl SeedableRng for SmallRng","synthetic":false,"types":["rand::rngs::small::SmallRng"]},{"text":"impl SeedableRng for StdRng","synthetic":false,"types":["rand::rngs::std::StdRng"]}]; if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/implementors/std/error/trait.Error.js b/implementors/std/error/trait.Error.js index 510007b..18666bc 100644 --- a/implementors/std/error/trait.Error.js +++ b/implementors/std/error/trait.Error.js @@ -20,7 +20,7 @@ implementors["language_tags"] = [{"text":"impl Error for SetLoggerError","synthetic":false,"types":["log::SetLoggerError"]},{"text":"impl Error for ParseLevelError","synthetic":false,"types":["log::ParseLevelError"]}]; implementors["mime"] = [{"text":"impl Error for FromStrError","synthetic":false,"types":["mime::FromStrError"]}]; implementors["nom"] = [{"text":"impl<I, E> Error for Err<I, E> where
    I: Debug,
    E: Debug
","synthetic":false,"types":["nom::internal::Err"]}]; -implementors["rand"] = [{"text":"impl Error for BernoulliError","synthetic":false,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl Error for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl Error for ReadError","synthetic":false,"types":["rand::rngs::adapter::read::ReadError"]}]; +implementors["rand"] = [{"text":"impl Error for WeightedError","synthetic":false,"types":["rand::distributions::weighted::WeightedError"]}]; implementors["rand_core"] = [{"text":"impl Error for Error","synthetic":false,"types":["rand_core::error::Error"]}]; implementors["rand_jitter"] = [{"text":"impl Error for TimerError","synthetic":false,"types":["rand_jitter::error::TimerError"]}]; implementors["regex"] = [{"text":"impl Error for Error","synthetic":false,"types":["regex::error::Error"]}]; diff --git a/implementors/std/panic/trait.RefUnwindSafe.js b/implementors/std/panic/trait.RefUnwindSafe.js index 9c903e2..2ac04bd 100644 --- a/implementors/std/panic/trait.RefUnwindSafe.js +++ b/implementors/std/panic/trait.RefUnwindSafe.js @@ -69,7 +69,7 @@ implementors["parser"] = [{"text":"impl !RefUnwindSafe for AsciiSet","synthetic":true,"types":["percent_encoding::AsciiSet"]},{"text":"impl<'a> RefUnwindSafe for PercentEncode<'a>","synthetic":true,"types":["percent_encoding::PercentEncode"]},{"text":"impl<'a> RefUnwindSafe for PercentDecode<'a>","synthetic":true,"types":["percent_encoding::PercentDecode"]}]; implementors["proc_macro2"] = [{"text":"impl !RefUnwindSafe for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl !RefUnwindSafe for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl !RefUnwindSafe for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl !RefUnwindSafe for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl !RefUnwindSafe for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl !RefUnwindSafe for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl !RefUnwindSafe for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl !RefUnwindSafe for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl RefUnwindSafe for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl RefUnwindSafe for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl !RefUnwindSafe for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> RefUnwindSafe for Context<X, E> where
    E: RefUnwindSafe,
    X: RefUnwindSafe
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl RefUnwindSafe for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl RefUnwindSafe for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl RefUnwindSafe for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl RefUnwindSafe for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> RefUnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl RefUnwindSafe for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl RefUnwindSafe for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl RefUnwindSafe for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl RefUnwindSafe for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl RefUnwindSafe for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl RefUnwindSafe for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl RefUnwindSafe for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl RefUnwindSafe for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl RefUnwindSafe for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl RefUnwindSafe for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl RefUnwindSafe for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl RefUnwindSafe for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl RefUnwindSafe for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl RefUnwindSafe for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl RefUnwindSafe for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl RefUnwindSafe for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl RefUnwindSafe for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl RefUnwindSafe for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl RefUnwindSafe for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> RefUnwindSafe for DistIter<D, R, T> where
    D: RefUnwindSafe,
    R: RefUnwindSafe,
    T: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl RefUnwindSafe for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl RefUnwindSafe for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> RefUnwindSafe for UniformInt<X> where
    X: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> RefUnwindSafe for UniformFloat<X> where
    X: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl RefUnwindSafe for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> RefUnwindSafe for WeightedIndex<X> where
    X: RefUnwindSafe,
    <X as SampleUniform>::Sampler: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl RefUnwindSafe for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> RefUnwindSafe for WeightedIndex<W> where
    W: RefUnwindSafe,
    <W as SampleUniform>::Sampler: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl RefUnwindSafe for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl RefUnwindSafe for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl RefUnwindSafe for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl !RefUnwindSafe for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> RefUnwindSafe for ReadRng<R> where
    R: RefUnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> RefUnwindSafe for ReseedingRng<R, Rsdr> where
    R: RefUnwindSafe,
    Rsdr: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl RefUnwindSafe for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> RefUnwindSafe for SliceChooseIter<'a, S, T> where
    S: RefUnwindSafe,
    T: RefUnwindSafe
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl RefUnwindSafe for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> RefUnwindSafe for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl RefUnwindSafe for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl RefUnwindSafe for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> RefUnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl RefUnwindSafe for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl RefUnwindSafe for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl RefUnwindSafe for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> RefUnwindSafe for WeightedIndex<X> where
    X: RefUnwindSafe,
    <X as SampleUniform>::Sampler: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl RefUnwindSafe for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl RefUnwindSafe for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl RefUnwindSafe for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl RefUnwindSafe for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl RefUnwindSafe for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl RefUnwindSafe for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl RefUnwindSafe for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl RefUnwindSafe for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl RefUnwindSafe for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl RefUnwindSafe for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl RefUnwindSafe for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl RefUnwindSafe for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl RefUnwindSafe for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl RefUnwindSafe for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl RefUnwindSafe for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl RefUnwindSafe for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl RefUnwindSafe for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl RefUnwindSafe for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl RefUnwindSafe for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> RefUnwindSafe for DistIter<'a, D, R, T> where
    D: RefUnwindSafe,
    R: RefUnwindSafe,
    T: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl RefUnwindSafe for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> RefUnwindSafe for Weighted<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> RefUnwindSafe for WeightedChoice<'a, T> where
    T: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl RefUnwindSafe for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> RefUnwindSafe for UniformInt<X> where
    X: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> RefUnwindSafe for UniformFloat<X> where
    X: RefUnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl RefUnwindSafe for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl RefUnwindSafe for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl RefUnwindSafe for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl RefUnwindSafe for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl RefUnwindSafe for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> RefUnwindSafe for ReadRng<R> where
    R: RefUnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> RefUnwindSafe for ReseedingRng<R, Rsdr> where
    R: RefUnwindSafe,
    Rsdr: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl RefUnwindSafe for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> RefUnwindSafe for SliceChooseIter<'a, S, T> where
    S: RefUnwindSafe,
    T: RefUnwindSafe
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl RefUnwindSafe for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> RefUnwindSafe for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl RefUnwindSafe for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl RefUnwindSafe for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl RefUnwindSafe for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl RefUnwindSafe for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl RefUnwindSafe for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl RefUnwindSafe for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl RefUnwindSafe for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl !RefUnwindSafe for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl RefUnwindSafe for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> RefUnwindSafe for BlockRng<R> where
    R: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> RefUnwindSafe for BlockRng64<R> where
    R: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl RefUnwindSafe for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl RefUnwindSafe for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/implementors/std/panic/trait.UnwindSafe.js b/implementors/std/panic/trait.UnwindSafe.js index da5202d..35ba506 100644 --- a/implementors/std/panic/trait.UnwindSafe.js +++ b/implementors/std/panic/trait.UnwindSafe.js @@ -69,7 +69,7 @@ implementors["parser"] = [{"text":"impl UnwindSafe for AsciiSet","synthetic":true,"types":["percent_encoding::AsciiSet"]},{"text":"impl<'a> UnwindSafe for PercentEncode<'a>","synthetic":true,"types":["percent_encoding::PercentEncode"]},{"text":"impl<'a> UnwindSafe for PercentDecode<'a>","synthetic":true,"types":["percent_encoding::PercentDecode"]}]; implementors["proc_macro2"] = [{"text":"impl UnwindSafe for TokenStream","synthetic":true,"types":["proc_macro2::TokenStream"]},{"text":"impl UnwindSafe for LexError","synthetic":true,"types":["proc_macro2::LexError"]},{"text":"impl UnwindSafe for Span","synthetic":true,"types":["proc_macro2::Span"]},{"text":"impl UnwindSafe for Group","synthetic":true,"types":["proc_macro2::Group"]},{"text":"impl UnwindSafe for Punct","synthetic":true,"types":["proc_macro2::Punct"]},{"text":"impl UnwindSafe for Ident","synthetic":true,"types":["proc_macro2::Ident"]},{"text":"impl UnwindSafe for Literal","synthetic":true,"types":["proc_macro2::Literal"]},{"text":"impl UnwindSafe for TokenTree","synthetic":true,"types":["proc_macro2::TokenTree"]},{"text":"impl UnwindSafe for Delimiter","synthetic":true,"types":["proc_macro2::Delimiter"]},{"text":"impl UnwindSafe for Spacing","synthetic":true,"types":["proc_macro2::Spacing"]},{"text":"impl !UnwindSafe for IntoIter","synthetic":true,"types":["proc_macro2::token_stream::IntoIter"]}]; implementors["quick_error"] = [{"text":"impl<X, E> UnwindSafe for Context<X, E> where
    E: UnwindSafe,
    X: UnwindSafe
","synthetic":true,"types":["quick_error::Context"]}]; -implementors["rand"] = [{"text":"impl UnwindSafe for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl UnwindSafe for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl UnwindSafe for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl UnwindSafe for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> UnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl UnwindSafe for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl UnwindSafe for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl UnwindSafe for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl UnwindSafe for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl UnwindSafe for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl UnwindSafe for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl UnwindSafe for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl UnwindSafe for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl UnwindSafe for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl UnwindSafe for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl UnwindSafe for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl UnwindSafe for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl UnwindSafe for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl UnwindSafe for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl UnwindSafe for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl UnwindSafe for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl UnwindSafe for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl UnwindSafe for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl UnwindSafe for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<D, R, T> UnwindSafe for DistIter<D, R, T> where
    D: UnwindSafe,
    R: UnwindSafe,
    T: UnwindSafe
","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl UnwindSafe for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl UnwindSafe for BernoulliError","synthetic":true,"types":["rand::distributions::bernoulli::BernoulliError"]},{"text":"impl<X> UnwindSafe for UniformInt<X> where
    X: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> UnwindSafe for UniformFloat<X> where
    X: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl UnwindSafe for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl<X> UnwindSafe for WeightedIndex<X> where
    X: UnwindSafe,
    <X as SampleUniform>::Sampler: UnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl UnwindSafe for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<W> UnwindSafe for WeightedIndex<W> where
    W: UnwindSafe,
    <W as SampleUniform>::Sampler: UnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::alias_method::WeightedIndex"]},{"text":"impl UnwindSafe for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl UnwindSafe for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl UnwindSafe for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl !UnwindSafe for ReadError","synthetic":true,"types":["rand::rngs::adapter::read::ReadError"]},{"text":"impl<R> UnwindSafe for ReadRng<R> where
    R: UnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> UnwindSafe for ReseedingRng<R, Rsdr> where
    R: UnwindSafe,
    Rsdr: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl UnwindSafe for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> UnwindSafe for SliceChooseIter<'a, S, T> where
    S: RefUnwindSafe,
    T: UnwindSafe
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl UnwindSafe for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> UnwindSafe for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl UnwindSafe for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; +implementors["rand"] = [{"text":"impl UnwindSafe for Alphanumeric","synthetic":true,"types":["rand::distributions::other::Alphanumeric"]},{"text":"impl<X> UnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::Uniform"]},{"text":"impl UnwindSafe for OpenClosed01","synthetic":true,"types":["rand::distributions::float::OpenClosed01"]},{"text":"impl UnwindSafe for Open01","synthetic":true,"types":["rand::distributions::float::Open01"]},{"text":"impl UnwindSafe for Bernoulli","synthetic":true,"types":["rand::distributions::bernoulli::Bernoulli"]},{"text":"impl<X> UnwindSafe for WeightedIndex<X> where
    X: UnwindSafe,
    <X as SampleUniform>::Sampler: UnwindSafe
","synthetic":true,"types":["rand::distributions::weighted::WeightedIndex"]},{"text":"impl UnwindSafe for UnitSphereSurface","synthetic":true,"types":["rand::distributions::unit_sphere::UnitSphereSurface"]},{"text":"impl UnwindSafe for UnitCircle","synthetic":true,"types":["rand::distributions::unit_circle::UnitCircle"]},{"text":"impl UnwindSafe for Gamma","synthetic":true,"types":["rand::distributions::gamma::Gamma"]},{"text":"impl UnwindSafe for ChiSquared","synthetic":true,"types":["rand::distributions::gamma::ChiSquared"]},{"text":"impl UnwindSafe for FisherF","synthetic":true,"types":["rand::distributions::gamma::FisherF"]},{"text":"impl UnwindSafe for StudentT","synthetic":true,"types":["rand::distributions::gamma::StudentT"]},{"text":"impl UnwindSafe for Beta","synthetic":true,"types":["rand::distributions::gamma::Beta"]},{"text":"impl UnwindSafe for Normal","synthetic":true,"types":["rand::distributions::normal::Normal"]},{"text":"impl UnwindSafe for LogNormal","synthetic":true,"types":["rand::distributions::normal::LogNormal"]},{"text":"impl UnwindSafe for StandardNormal","synthetic":true,"types":["rand::distributions::normal::StandardNormal"]},{"text":"impl UnwindSafe for Exp","synthetic":true,"types":["rand::distributions::exponential::Exp"]},{"text":"impl UnwindSafe for Exp1","synthetic":true,"types":["rand::distributions::exponential::Exp1"]},{"text":"impl UnwindSafe for Pareto","synthetic":true,"types":["rand::distributions::pareto::Pareto"]},{"text":"impl UnwindSafe for Poisson","synthetic":true,"types":["rand::distributions::poisson::Poisson"]},{"text":"impl UnwindSafe for Binomial","synthetic":true,"types":["rand::distributions::binomial::Binomial"]},{"text":"impl UnwindSafe for Cauchy","synthetic":true,"types":["rand::distributions::cauchy::Cauchy"]},{"text":"impl UnwindSafe for Dirichlet","synthetic":true,"types":["rand::distributions::dirichlet::Dirichlet"]},{"text":"impl UnwindSafe for Triangular","synthetic":true,"types":["rand::distributions::triangular::Triangular"]},{"text":"impl UnwindSafe for Weibull","synthetic":true,"types":["rand::distributions::weibull::Weibull"]},{"text":"impl<'a, D, R, T> !UnwindSafe for DistIter<'a, D, R, T>","synthetic":true,"types":["rand::distributions::DistIter"]},{"text":"impl UnwindSafe for Standard","synthetic":true,"types":["rand::distributions::Standard"]},{"text":"impl<T> UnwindSafe for Weighted<T> where
    T: UnwindSafe
","synthetic":true,"types":["rand::distributions::Weighted"]},{"text":"impl<'a, T> !UnwindSafe for WeightedChoice<'a, T>","synthetic":true,"types":["rand::distributions::WeightedChoice"]},{"text":"impl UnwindSafe for WeightedError","synthetic":true,"types":["rand::distributions::weighted::WeightedError"]},{"text":"impl<X> UnwindSafe for UniformInt<X> where
    X: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformInt"]},{"text":"impl<X> UnwindSafe for UniformFloat<X> where
    X: UnwindSafe
","synthetic":true,"types":["rand::distributions::uniform::UniformFloat"]},{"text":"impl UnwindSafe for UniformDuration","synthetic":true,"types":["rand::distributions::uniform::UniformDuration"]},{"text":"impl UnwindSafe for EntropyRng","synthetic":true,"types":["rand::rngs::entropy::EntropyRng"]},{"text":"impl UnwindSafe for SmallRng","synthetic":true,"types":["rand::rngs::small::SmallRng"]},{"text":"impl UnwindSafe for StdRng","synthetic":true,"types":["rand::rngs::std::StdRng"]},{"text":"impl UnwindSafe for ThreadRng","synthetic":true,"types":["rand::rngs::thread::ThreadRng"]},{"text":"impl<R> UnwindSafe for ReadRng<R> where
    R: UnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::read::ReadRng"]},{"text":"impl<R, Rsdr> UnwindSafe for ReseedingRng<R, Rsdr> where
    R: UnwindSafe,
    Rsdr: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe
","synthetic":true,"types":["rand::rngs::adapter::reseeding::ReseedingRng"]},{"text":"impl UnwindSafe for StepRng","synthetic":true,"types":["rand::rngs::mock::StepRng"]},{"text":"impl<'a, S: ?Sized, T> UnwindSafe for SliceChooseIter<'a, S, T> where
    S: RefUnwindSafe,
    T: UnwindSafe
","synthetic":true,"types":["rand::seq::SliceChooseIter"]},{"text":"impl UnwindSafe for IndexVec","synthetic":true,"types":["rand::seq::index::IndexVec"]},{"text":"impl<'a> UnwindSafe for IndexVecIter<'a>","synthetic":true,"types":["rand::seq::index::IndexVecIter"]},{"text":"impl UnwindSafe for IndexVecIntoIter","synthetic":true,"types":["rand::seq::index::IndexVecIntoIter"]}]; implementors["rand_chacha"] = [{"text":"impl UnwindSafe for ChaCha12Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Core"]},{"text":"impl UnwindSafe for ChaCha12Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha12Rng"]},{"text":"impl UnwindSafe for ChaCha20Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Core"]},{"text":"impl UnwindSafe for ChaCha20Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha20Rng"]},{"text":"impl UnwindSafe for ChaCha8Core","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Core"]},{"text":"impl UnwindSafe for ChaCha8Rng","synthetic":true,"types":["rand_chacha::chacha::ChaCha8Rng"]}]; implementors["rand_core"] = [{"text":"impl !UnwindSafe for Error","synthetic":true,"types":["rand_core::error::Error"]},{"text":"impl UnwindSafe for OsRng","synthetic":true,"types":["rand_core::os::OsRng"]},{"text":"impl<R: ?Sized> UnwindSafe for BlockRng<R> where
    R: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe
","synthetic":true,"types":["rand_core::block::BlockRng"]},{"text":"impl<R: ?Sized> UnwindSafe for BlockRng64<R> where
    R: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe
","synthetic":true,"types":["rand_core::block::BlockRng64"]}]; implementors["rand_hc"] = [{"text":"impl UnwindSafe for Hc128Rng","synthetic":true,"types":["rand_hc::hc128::Hc128Rng"]},{"text":"impl UnwindSafe for Hc128Core","synthetic":true,"types":["rand_hc::hc128::Hc128Core"]}]; diff --git a/rand/all.html b/rand/all.html index 2f0e480..c9dff9f 100644 --- a/rand/all.html +++ b/rand/all.html @@ -1,3 +1,3 @@ List of all items in this crate

[] - List of all items

Structs

Enums

Traits

Functions

\ No newline at end of file + List of all items

Structs

Enums

Traits

Functions

\ No newline at end of file diff --git a/rand/distributions/index.html b/rand/distributions/index.html index abd8dd3..2ef5107 100644 --- a/rand/distributions/index.html +++ b/rand/distributions/index.html @@ -1,8 +1,8 @@ -rand::distributions - Rust

[][src]Module rand::distributions

Generating random samples from probability distributions

+rand::distributions - Rust

[][src]Module rand::distributions

Generating random samples from probability distributions.

This module is the home of the [Distribution] trait and several of its implementations. It is the workhorse behind some of the convenient -functionality of the [Rng] trait, e.g. [Rng::gen], [Rng::gen_range] and -of course [Rng::sample].

+functionality of the [Rng] trait, including gen, gen_range and +of course sample.

Abstractly, a probability distribution describes the probability of occurance of each value in its sample space.

More concretely, an implementation of Distribution<T> for type X is an @@ -12,92 +12,165 @@ randomness (an RNG supplied to the sample function).

A type X may implement Distribution<T> for multiple types T. Any type implementing [Distribution] is stateless (i.e. immutable), but it may have internal parameters set at construction time (for example, -[Uniform] allows specification of its sample space as a range within T).

+Uniform allows specification of its sample space as a range within T).

The Standard distribution

-

The [Standard] distribution is important to mention. This is the -distribution used by [Rng::gen] and represents the "default" way to +

The Standard distribution is important to mention. This is the +distribution used by [Rng::gen()] and represents the "default" way to produce a random value for many different types, including most primitive types, tuples, arrays, and a few derived types. See the documentation of -[Standard] for more details.

-

Implementing Distribution<T> for [Standard] for user types T makes it -possible to generate type T with [Rng::gen], and by extension also -with the random function.

-

Random characters

-

[Alphanumeric] is a simple distribution to sample random letters and -numbers of the char type; in contrast [Standard] may sample any valid -char.

-

Uniform numeric ranges

-

The [Uniform] distribution is more flexible than [Standard], but also +Standard for more details.

+

Implementing Distribution<T> for Standard for user types T makes it +possible to generate type T with [Rng::gen()], and by extension also +with the [random()] function.

+

Distribution to sample from a Uniform range

+

The Uniform distribution is more flexible than Standard, but also more specialised: it supports fewer target types, but allows the sample space to be specified as an arbitrary range within its target type T. -Both [Standard] and [Uniform] are in some sense uniform distributions.

+Both Standard and Uniform are in some sense uniform distributions.

Values may be sampled from this distribution using [Rng::gen_range] or -by creating a distribution object with [Uniform::new], -[Uniform::new_inclusive] or From<Range>. When the range limits are not +by creating a distribution object with Uniform::new, +Uniform::new_inclusive or From<Range>. When the range limits are not known at compile time it is typically faster to reuse an existing distribution object than to call [Rng::gen_range].

-

User types T may also implement Distribution<T> for [Uniform], -although this is less straightforward than for [Standard] (see the -documentation in the [uniform] module. Doing so enables generation of +

User types T may also implement Distribution<T> for Uniform, +although this is less straightforward than for Standard (see the +documentation in the uniform module. Doing so enables generation of values of type T with [Rng::gen_range].

-

Open and half-open ranges

+

Other distributions

There are surprisingly many ways to uniformly generate random floats. A range between 0 and 1 is standard, but the exact bounds (open vs closed) -and accuracy differ. In addition to the [Standard] distribution Rand offers -[Open01] and [OpenClosed01]. See "Floating point implementation" section of -[Standard] documentation for more details.

-

Non-uniform sampling

-

Sampling a simple true/false outcome with a given probability has a name: -the [Bernoulli] distribution (this is used by [Rng::gen_bool]).

-

For weighted sampling from a sequence of discrete values, use the -[weighted] module.

-

This crate no longer includes other non-uniform distributions; instead -it is recommended that you use either rand_distr or statrs.

-

Re-exports

-
pub use self::weighted::WeightedError;
pub use self::weighted::WeightedIndex;

Modules

+and accuracy differ. In addition to the Standard distribution Rand offers +Open01 and OpenClosed01. See "Floating point implementation" section of +Standard documentation for more details.

+

Alphanumeric is a simple distribution to sample random letters and +numbers of the char type; in contrast Standard may sample any valid +char.

+

WeightedIndex can be used to do weighted sampling from a set of items, +such as from an array.

+

Non-uniform probability distributions

+

Rand currently provides the following probability distributions:

+
    +
  • Related to real-valued quantities that grow linearly +(e.g. errors, offsets): + +
  • +
  • Related to Bernoulli trials (yes/no events, with a given probability): + +
  • +
  • Related to positive real-valued quantities that grow exponentially +(e.g. prices, incomes, populations): + +
  • +
  • Related to the occurrence of independent events at a given rate: + +
  • +
  • Gamma and derived distributions: + +
  • +
  • Triangular distribution: + +
  • +
  • Multivariate probability distributions + +
  • +
+

Examples

+

Sampling from a distribution:

+ +
+use rand::{thread_rng, Rng};
+use rand::distributions::Exp;
+
+let exp = Exp::new(2.0);
+let v = thread_rng().sample(exp);
+println!("{} is from an Exp(2) distribution", v);
+

Implementing the Standard distribution for a user type:

+ +
+use rand::Rng;
+use rand::distributions::{Distribution, Standard};
+
+struct MyF32 {
+    x: f32,
+}
+
+impl Distribution<MyF32> for Standard {
+    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
+        MyF32 { x: rng.gen() }
+    }
+}
+

Modules

uniform

A distribution uniformly sampling numbers within a given range.

-
weighted

Weighted index sampling

Structs

Alphanumeric

Sample a char, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9.

Bernoulli

The Bernoulli distribution.

-
BetaDeprecated

The Beta distribution with shape parameters alpha and beta.

-
BinomialDeprecated

The binomial distribution Binomial(n, p).

-
CauchyDeprecated

The Cauchy distribution Cauchy(median, scale).

-
ChiSquaredDeprecated

The chi-squared distribution χ²(k), where k is the degrees of +

Beta

The Beta distribution with shape parameters alpha and beta.

+
Binomial

The binomial distribution Binomial(n, p).

+
Cauchy

The Cauchy distribution Cauchy(median, scale).

+
ChiSquared

The chi-squared distribution χ²(k), where k is the degrees of freedom.

-
DirichletDeprecated

The dirichelet distribution Dirichlet(alpha).

+
Dirichlet

The dirichelet distribution Dirichlet(alpha).

DistIter

An iterator that generates random values of T with distribution D, using R as the source of randomness.

-
ExpDeprecated

The exponential distribution Exp(lambda).

-
Exp1Deprecated

Samples floating-point numbers according to the exponential distribution, +

Exp

The exponential distribution Exp(lambda).

+
Exp1

Samples floating-point numbers according to the exponential distribution, with rate parameter λ = 1. This is equivalent to Exp::new(1.0) or sampling with -rng.gen::<f64>().ln(), but faster.

-
FisherFDeprecated

The Fisher F distribution F(m, n).

-
GammaDeprecated

The Gamma distribution Gamma(shape, scale) distribution.

-
LogNormalDeprecated

The log-normal distribution ln N(mean, std_dev**2).

-
NormalDeprecated

The normal distribution N(mean, std_dev**2).

+
FisherF

The Fisher F distribution F(m, n).

+
Gamma

The Gamma distribution Gamma(shape, scale) distribution.

+
LogNormal

The log-normal distribution ln N(mean, std_dev**2).

+
Normal

The normal distribution N(mean, std_dev**2).

Open01

A distribution to sample floating point numbers uniformly in the open interval (0, 1), i.e. not including either endpoint.

OpenClosed01

A distribution to sample floating point numbers uniformly in the half-open interval (0, 1], i.e. including 1 but not 0.

-
ParetoDeprecated

Samples floating-point numbers according to the Pareto distribution

-
PoissonDeprecated

The Poisson distribution Poisson(lambda).

+
Pareto

Samples floating-point numbers according to the Pareto distribution

+
Poisson

The Poisson distribution Poisson(lambda).

Standard

A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.

-
StandardNormalDeprecated

Samples floating-point numbers according to the normal distribution +

StandardNormal

Samples floating-point numbers according to the normal distribution N(0, 1) (a.k.a. a standard normal, or Gaussian). This is equivalent to Normal::new(0.0, 1.0) but faster.

-
StudentTDeprecated

The Student t distribution, t(nu), where nu is the degrees of +

StudentT

The Student t distribution, t(nu), where nu is the degrees of freedom.

-
TriangularDeprecated

The triangular distribution.

+
Triangular

The triangular distribution.

Uniform

Sample values uniformly between two bounds.

-
UnitCircleDeprecated

Samples uniformly from the edge of the unit circle in two dimensions.

-
UnitSphereSurfaceDeprecated

Samples uniformly from the surface of the unit sphere in three dimensions.

-
WeibullDeprecated

Samples floating-point numbers according to the Weibull distribution

+
UnitCircle

Samples uniformly from the edge of the unit circle in two dimensions.

+
UnitSphereSurface

Samples uniformly from the surface of the unit sphere in three dimensions.

+
Weibull

Samples floating-point numbers according to the Weibull distribution

+
WeightedDeprecated

A value with a particular weight for use with WeightedChoice.

+
WeightedChoiceDeprecated

A distribution that selects from a finite collection of weighted items.

+
WeightedIndex

A distribution using weighted sampling to pick a discretely selected +item.

Enums

-
BernoulliError

Error type returned from Bernoulli::new.

+
WeightedError

Error type returned from WeightedIndex::new.

Traits

Distribution

Types (distributions) that can be used to create a random instance of T.

\ No newline at end of file diff --git a/rand/distributions/sidebar-items.js b/rand/distributions/sidebar-items.js index ce19081..e7e817d 100644 --- a/rand/distributions/sidebar-items.js +++ b/rand/distributions/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"enum":[["BernoulliError","Error type returned from `Bernoulli::new`."]],"mod":[["uniform","A distribution uniformly sampling numbers within a given range."],["weighted","Weighted index sampling"]],"struct":[["Alphanumeric","Sample a `char`, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9."],["Bernoulli","The Bernoulli distribution."],["Beta","The Beta distribution with shape parameters `alpha` and `beta`."],["Binomial","The binomial distribution `Binomial(n, p)`."],["Cauchy","The Cauchy distribution `Cauchy(median, scale)`."],["ChiSquared","The chi-squared distribution `χ²(k)`, where `k` is the degrees of freedom."],["Dirichlet","The dirichelet distribution `Dirichlet(alpha)`."],["DistIter","An iterator that generates random values of `T` with distribution `D`, using `R` as the source of randomness."],["Exp","The exponential distribution `Exp(lambda)`."],["Exp1","Samples floating-point numbers according to the exponential distribution, with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or sampling with `-rng.gen::().ln()`, but faster."],["FisherF","The Fisher F distribution `F(m, n)`."],["Gamma","The Gamma distribution `Gamma(shape, scale)` distribution."],["LogNormal","The log-normal distribution `ln N(mean, std_dev**2)`."],["Normal","The normal distribution `N(mean, std_dev**2)`."],["Open01","A distribution to sample floating point numbers uniformly in the open interval `(0, 1)`, i.e. not including either endpoint."],["OpenClosed01","A distribution to sample floating point numbers uniformly in the half-open interval `(0, 1]`, i.e. including 1 but not 0."],["Pareto","Samples floating-point numbers according to the Pareto distribution"],["Poisson","The Poisson distribution `Poisson(lambda)`."],["Standard","A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type."],["StandardNormal","Samples floating-point numbers according to the normal distribution `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to `Normal::new(0.0, 1.0)` but faster."],["StudentT","The Student t distribution, `t(nu)`, where `nu` is the degrees of freedom."],["Triangular","The triangular distribution."],["Uniform","Sample values uniformly between two bounds."],["UnitCircle","Samples uniformly from the edge of the unit circle in two dimensions."],["UnitSphereSurface","Samples uniformly from the surface of the unit sphere in three dimensions."],["Weibull","Samples floating-point numbers according to the Weibull distribution"]],"trait":[["Distribution","Types (distributions) that can be used to create a random instance of `T`."]]}); \ No newline at end of file +initSidebarItems({"enum":[["WeightedError","Error type returned from `WeightedIndex::new`."]],"mod":[["uniform","A distribution uniformly sampling numbers within a given range."]],"struct":[["Alphanumeric","Sample a `char`, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9."],["Bernoulli","The Bernoulli distribution."],["Beta","The Beta distribution with shape parameters `alpha` and `beta`."],["Binomial","The binomial distribution `Binomial(n, p)`."],["Cauchy","The Cauchy distribution `Cauchy(median, scale)`."],["ChiSquared","The chi-squared distribution `χ²(k)`, where `k` is the degrees of freedom."],["Dirichlet","The dirichelet distribution `Dirichlet(alpha)`."],["DistIter","An iterator that generates random values of `T` with distribution `D`, using `R` as the source of randomness."],["Exp","The exponential distribution `Exp(lambda)`."],["Exp1","Samples floating-point numbers according to the exponential distribution, with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or sampling with `-rng.gen::().ln()`, but faster."],["FisherF","The Fisher F distribution `F(m, n)`."],["Gamma","The Gamma distribution `Gamma(shape, scale)` distribution."],["LogNormal","The log-normal distribution `ln N(mean, std_dev**2)`."],["Normal","The normal distribution `N(mean, std_dev**2)`."],["Open01","A distribution to sample floating point numbers uniformly in the open interval `(0, 1)`, i.e. not including either endpoint."],["OpenClosed01","A distribution to sample floating point numbers uniformly in the half-open interval `(0, 1]`, i.e. including 1 but not 0."],["Pareto","Samples floating-point numbers according to the Pareto distribution"],["Poisson","The Poisson distribution `Poisson(lambda)`."],["Standard","A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type."],["StandardNormal","Samples floating-point numbers according to the normal distribution `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to `Normal::new(0.0, 1.0)` but faster."],["StudentT","The Student t distribution, `t(nu)`, where `nu` is the degrees of freedom."],["Triangular","The triangular distribution."],["Uniform","Sample values uniformly between two bounds."],["UnitCircle","Samples uniformly from the edge of the unit circle in two dimensions."],["UnitSphereSurface","Samples uniformly from the surface of the unit sphere in three dimensions."],["Weibull","Samples floating-point numbers according to the Weibull distribution"],["Weighted","A value with a particular weight for use with `WeightedChoice`."],["WeightedChoice","A distribution that selects from a finite collection of weighted items."],["WeightedIndex","A distribution using weighted sampling to pick a discretely selected item."]],"trait":[["Distribution","Types (distributions) that can be used to create a random instance of `T`."]]}); \ No newline at end of file diff --git a/rand/distributions/struct.Alphanumeric.html b/rand/distributions/struct.Alphanumeric.html index b14b781..7e16d13 100644 --- a/rand/distributions/struct.Alphanumeric.html +++ b/rand/distributions/struct.Alphanumeric.html @@ -1,11 +1,11 @@ -rand::distributions::Alphanumeric - Rust

[][src]Struct rand::distributions::Alphanumeric

pub struct Alphanumeric;

Sample a char, uniformly distributed over ASCII letters and numbers: +rand::distributions::Alphanumeric - Rust

[][src]Struct rand::distributions::Alphanumeric

pub struct Alphanumeric;

Sample a char, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9.

Example

 use std::iter;
 use rand::{Rng, thread_rng};
 use rand::distributions::Alphanumeric;
-
+ 
 let mut rng = thread_rng();
 let chars: String = iter::repeat(())
         .map(|()| rng.sample(Alphanumeric))
@@ -13,8 +13,8 @@ a-z, A-Z and 0-9.

.collect(); println!("Random chars: {}", chars);

Trait Implementations

impl Debug for Alphanumeric[src]

impl Distribution<char> for Alphanumeric[src]

impl Distribution<char> for Alphanumeric[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Bernoulli.html b/rand/distributions/struct.Bernoulli.html index 4f46dc0..763c494 100644 --- a/rand/distributions/struct.Bernoulli.html +++ b/rand/distributions/struct.Bernoulli.html @@ -1,35 +1,37 @@ -rand::distributions::Bernoulli - Rust

[][src]Struct rand::distributions::Bernoulli

pub struct Bernoulli { /* fields omitted */ }

The Bernoulli distribution.

+rand::distributions::Bernoulli - Rust

[][src]Struct rand::distributions::Bernoulli

pub struct Bernoulli { /* fields omitted */ }

The Bernoulli distribution.

This is a special case of the Binomial distribution where n = 1.

Example

 use rand::distributions::{Bernoulli, Distribution};
 
-let d = Bernoulli::new(0.3).unwrap();
+let d = Bernoulli::new(0.3);
 let v = d.sample(&mut rand::thread_rng());
 println!("{} is from a Bernoulli distribution", v);

Precision

This Bernoulli distribution uses 64 bits from the RNG (a u64), so only probabilities that are multiples of 2-64 can be represented.

-

Methods

impl Bernoulli[src]

pub fn new(p: f64) -> Result<Bernoulli, BernoulliError>[src]

Construct a new Bernoulli with the given probability of success p.

+

Methods

impl Bernoulli[src]

pub fn new(p: f64) -> Bernoulli[src]

Construct a new Bernoulli with the given probability of success p.

+

Panics

+

If p < 0 or p > 1.

Precision

For p = 1.0, the resulting distribution will always generate true. For p = 0.0, the resulting distribution will always generate false.

This method is accurate for any input p in the range [0, 1] which is a multiple of 2-64. (Note that not all multiples of 2-64 in [0, 1] can be represented as a f64.)

-

pub fn from_ratio(
    numerator: u32,
    denominator: u32
) -> Result<Bernoulli, BernoulliError>
[src]

Construct a new Bernoulli with the probability of success of +

pub fn from_ratio(numerator: u32, denominator: u32) -> Bernoulli[src]

Construct a new Bernoulli with the probability of success of numerator-in-denominator. I.e. new_ratio(2, 3) will return a Bernoulli with a 2-in-3 chance, or about 67%, of returning true.

-

return true. If numerator == 0 it will always return false. -For numerator > denominator and denominator == 0, this returns an -error. Otherwise, for numerator == denominator, samples are always -true; for numerator == 0 samples are always false.

-

Trait Implementations

impl Clone for Bernoulli[src]

Trait Implementations

impl Clone for Bernoulli[src]

impl Copy for Bernoulli[src]

impl Debug for Bernoulli[src]

impl Distribution<bool> for Bernoulli[src]

impl Copy for Bernoulli[src]

impl Debug for Bernoulli[src]

impl Distribution<bool> for Bernoulli[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Beta.html b/rand/distributions/struct.Beta.html index 87c6eb6..da305ef 100644 --- a/rand/distributions/struct.Beta.html +++ b/rand/distributions/struct.Beta.html @@ -1,13 +1,19 @@ -rand::distributions::Beta - Rust

[][src]Struct rand::distributions::Beta

pub struct Beta { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Beta distribution with shape parameters alpha and beta.

-

Methods

impl Beta[src]

pub fn new(alpha: f64, beta: f64) -> Beta[src]

Construct an object representing the Beta(alpha, beta) +rand::distributions::Beta - Rust

[][src]Struct rand::distributions::Beta

pub struct Beta { /* fields omitted */ }

The Beta distribution with shape parameters alpha and beta.

+

Example

+
+use rand::distributions::{Distribution, Beta};
+
+let beta = Beta::new(2.0, 5.0);
+let v = beta.sample(&mut rand::thread_rng());
+println!("{} is from a Beta(2, 5) distribution", v);
+

Methods

impl Beta[src]

pub fn new(alpha: f64, beta: f64) -> Beta[src]

Construct an object representing the Beta(alpha, beta) distribution.

Panics if shape <= 0 or scale <= 0.

-

Trait Implementations

impl Clone for Beta[src]

Trait Implementations

impl Clone for Beta[src]

impl Copy for Beta[src]

impl Debug for Beta[src]

impl Distribution<f64> for Beta[src]

impl Copy for Beta[src]

impl Debug for Beta[src]

impl Distribution<f64> for Beta[src]

Auto Trait Implementations

impl RefUnwindSafe for Beta

impl Send for Beta

impl Sync for Beta

impl Unpin for Beta

impl UnwindSafe for Beta

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Binomial.html b/rand/distributions/struct.Binomial.html index 092f5d2..4beaf13 100644 --- a/rand/distributions/struct.Binomial.html +++ b/rand/distributions/struct.Binomial.html @@ -1,15 +1,21 @@ -rand::distributions::Binomial - Rust

[][src]Struct rand::distributions::Binomial

pub struct Binomial { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The binomial distribution Binomial(n, p).

+rand::distributions::Binomial - Rust

[][src]Struct rand::distributions::Binomial

pub struct Binomial { /* fields omitted */ }

The binomial distribution Binomial(n, p).

This distribution has density function: f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k) for k >= 0.

-

Methods

impl Binomial[src]

pub fn new(n: u64, p: f64) -> Binomial[src]

Construct a new Binomial with the given shape parameters n (number +

Example

+
+use rand::distributions::{Binomial, Distribution};
+
+let bin = Binomial::new(20, 0.3);
+let v = bin.sample(&mut rand::thread_rng());
+println!("{} is from a binomial distribution", v);
+

Methods

impl Binomial[src]

pub fn new(n: u64, p: f64) -> Binomial[src]

Construct a new Binomial with the given shape parameters n (number of trials) and p (probability of success).

Panics if p < 0 or p > 1.

-

Trait Implementations

impl Clone for Binomial[src]

Trait Implementations

impl Clone for Binomial[src]

impl Copy for Binomial[src]

impl Debug for Binomial[src]

impl Distribution<u64> for Binomial[src]

impl Copy for Binomial[src]

impl Debug for Binomial[src]

impl Distribution<u64> for Binomial[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Cauchy.html b/rand/distributions/struct.Cauchy.html index 8126945..7897778 100644 --- a/rand/distributions/struct.Cauchy.html +++ b/rand/distributions/struct.Cauchy.html @@ -1,15 +1,21 @@ -rand::distributions::Cauchy - Rust

[][src]Struct rand::distributions::Cauchy

pub struct Cauchy { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Cauchy distribution Cauchy(median, scale).

+rand::distributions::Cauchy - Rust

[][src]Struct rand::distributions::Cauchy

pub struct Cauchy { /* fields omitted */ }

The Cauchy distribution Cauchy(median, scale).

This distribution has a density function: f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))

-

Methods

impl Cauchy[src]

pub fn new(median: f64, scale: f64) -> Cauchy[src]

Construct a new Cauchy with the given shape parameters +

Example

+
+use rand::distributions::{Cauchy, Distribution};
+
+let cau = Cauchy::new(2.0, 5.0);
+let v = cau.sample(&mut rand::thread_rng());
+println!("{} is from a Cauchy(2, 5) distribution", v);
+

Methods

impl Cauchy[src]

pub fn new(median: f64, scale: f64) -> Cauchy[src]

Construct a new Cauchy with the given shape parameters median the peak location and scale the scale factor. Panics if scale <= 0.

-

Trait Implementations

impl Clone for Cauchy[src]

Trait Implementations

impl Clone for Cauchy[src]

impl Copy for Cauchy[src]

impl Debug for Cauchy[src]

impl Distribution<f64> for Cauchy[src]

impl Copy for Cauchy[src]

impl Debug for Cauchy[src]

impl Distribution<f64> for Cauchy[src]

Auto Trait Implementations

impl RefUnwindSafe for Cauchy

impl Send for Cauchy

impl Sync for Cauchy

impl Unpin for Cauchy

impl UnwindSafe for Cauchy

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.ChiSquared.html b/rand/distributions/struct.ChiSquared.html index 2a2d024..def66ab 100644 --- a/rand/distributions/struct.ChiSquared.html +++ b/rand/distributions/struct.ChiSquared.html @@ -1,17 +1,23 @@ -rand::distributions::ChiSquared - Rust

[][src]Struct rand::distributions::ChiSquared

pub struct ChiSquared { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The chi-squared distribution χ²(k), where k is the degrees of +rand::distributions::ChiSquared - Rust

[][src]Struct rand::distributions::ChiSquared

pub struct ChiSquared { /* fields omitted */ }

The chi-squared distribution χ²(k), where k is the degrees of freedom.

For k > 0 integral, this distribution is the sum of the squares of k independent standard normal random variables. For other k, this uses the equivalent characterisation χ²(k) = Gamma(k/2, 2).

-

Methods

impl ChiSquared[src]

pub fn new(k: f64) -> ChiSquared[src]

Create a new chi-squared distribution with degrees-of-freedom +

Example

+
+use rand::distributions::{ChiSquared, Distribution};
+
+let chi = ChiSquared::new(11.0);
+let v = chi.sample(&mut rand::thread_rng());
+println!("{} is from a χ²(11) distribution", v)
+

Methods

impl ChiSquared[src]

pub fn new(k: f64) -> ChiSquared[src]

Create a new chi-squared distribution with degrees-of-freedom k. Panics if k < 0.

-

Trait Implementations

impl Clone for ChiSquared[src]

Trait Implementations

impl Clone for ChiSquared[src]

impl Copy for ChiSquared[src]

impl Debug for ChiSquared[src]

impl Distribution<f64> for ChiSquared[src]

impl Copy for ChiSquared[src]

impl Debug for ChiSquared[src]

impl Distribution<f64> for ChiSquared[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Dirichlet.html b/rand/distributions/struct.Dirichlet.html index b4afac5..165a67b 100644 --- a/rand/distributions/struct.Dirichlet.html +++ b/rand/distributions/struct.Dirichlet.html @@ -1,24 +1,31 @@ -rand::distributions::Dirichlet - Rust

[][src]Struct rand::distributions::Dirichlet

pub struct Dirichlet { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The dirichelet distribution Dirichlet(alpha).

+rand::distributions::Dirichlet - Rust

[][src]Struct rand::distributions::Dirichlet

pub struct Dirichlet { /* fields omitted */ }

The dirichelet distribution Dirichlet(alpha).

The Dirichlet distribution is a family of continuous multivariate probability distributions parameterized by a vector alpha of positive reals. It is a multivariate generalization of the beta distribution.

-

Methods

impl Dirichlet[src]

pub fn new<V: Into<Vec<f64>>>(alpha: V) -> Dirichlet[src]

Construct a new Dirichlet with the given alpha parameter alpha.

+

Example

+
+use rand::prelude::*;
+use rand::distributions::Dirichlet;
+
+let dirichlet = Dirichlet::new(vec![1.0, 2.0, 3.0]);
+let samples = dirichlet.sample(&mut rand::thread_rng());
+println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples);
+

Methods

impl Dirichlet[src]

pub fn new<V: Into<Vec<f64>>>(alpha: V) -> Dirichlet[src]

Construct a new Dirichlet with the given alpha parameter alpha.

Panics

  • if alpha.len() < 2
-

pub fn new_with_param(alpha: f64, size: usize) -> Dirichlet[src]

Construct a new Dirichlet with the given shape parameter alpha and size.

+

pub fn new_with_param(alpha: f64, size: usize) -> Dirichlet[src]

Construct a new Dirichlet with the given shape parameter alpha and size.

Panics

  • if alpha <= 0.0
  • if size < 2
-

Trait Implementations

impl Clone for Dirichlet[src]

Trait Implementations

impl Clone for Dirichlet[src]

impl Debug for Dirichlet[src]

impl Distribution<Vec<f64>> for Dirichlet[src]

impl Debug for Dirichlet[src]

impl Distribution<Vec<f64>> for Dirichlet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.DistIter.html b/rand/distributions/struct.DistIter.html index 915afbe..b4b5999 100644 --- a/rand/distributions/struct.DistIter.html +++ b/rand/distributions/struct.DistIter.html @@ -1,11 +1,11 @@ -rand::distributions::DistIter - Rust

[][src]Struct rand::distributions::DistIter

pub struct DistIter<D, R, T> { /* fields omitted */ }

An iterator that generates random values of T with distribution D, +rand::distributions::DistIter - Rust

[][src]Struct rand::distributions::DistIter

pub struct DistIter<'a, D: 'a, R: 'a, T> { /* fields omitted */ }

An iterator that generates random values of T with distribution D, using R as the source of randomness.

This struct is created by the sample_iter method on [Distribution]. See its documentation for more.

-

Trait Implementations

impl<D: Debug, R: Debug, T: Debug> Debug for DistIter<D, R, T>[src]

impl<D, R, T> FusedIterator for DistIter<D, R, T> where
    D: Distribution<T>,
    R: Rng
[src]

impl<D, R, T> Iterator for DistIter<D, R, T> where
    D: Distribution<T>,
    R: Rng
[src]

type Item = T

The type of the elements being iterated over.

-

Trait Implementations

impl<'a, D: Debug + 'a, R: Debug + 'a, T: Debug> Debug for DistIter<'a, D, R, T>[src]

impl<'a, D, R, T> FusedIterator for DistIter<'a, D, R, T> where
    D: Distribution<T>,
    R: Rng + 'a, 
[src]

impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
    D: Distribution<T>,
    R: Rng + 'a, 
[src]

type Item = T

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<D, R, T> RefUnwindSafe for DistIter<D, R, T> where
    D: RefUnwindSafe,
    R: RefUnwindSafe,
    T: RefUnwindSafe

impl<D, R, T> Send for DistIter<D, R, T> where
    D: Send,
    R: Send,
    T: Send

impl<D, R, T> Sync for DistIter<D, R, T> where
    D: Sync,
    R: Sync,
    T: Sync

impl<D, R, T> Unpin for DistIter<D, R, T> where
    D: Unpin,
    R: Unpin,
    T: Unpin

impl<D, R, T> UnwindSafe for DistIter<D, R, T> where
    D: UnwindSafe,
    R: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

Auto Trait Implementations

impl<'a, D, R, T> RefUnwindSafe for DistIter<'a, D, R, T> where
    D: RefUnwindSafe,
    R: RefUnwindSafe,
    T: RefUnwindSafe

impl<'a, D, R, T> Send for DistIter<'a, D, R, T> where
    D: Sync,
    R: Send,
    T: Send

impl<'a, D, R, T> Sync for DistIter<'a, D, R, T> where
    D: Sync,
    R: Sync,
    T: Sync

impl<'a, D, R, T> Unpin for DistIter<'a, D, R, T> where
    T: Unpin

impl<'a, D, R, T> !UnwindSafe for DistIter<'a, D, R, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Exp.html b/rand/distributions/struct.Exp.html index 15f9755..93e8aaa 100644 --- a/rand/distributions/struct.Exp.html +++ b/rand/distributions/struct.Exp.html @@ -1,15 +1,21 @@ -rand::distributions::Exp - Rust

[][src]Struct rand::distributions::Exp

pub struct Exp { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The exponential distribution Exp(lambda).

+rand::distributions::Exp - Rust

[][src]Struct rand::distributions::Exp

pub struct Exp { /* fields omitted */ }

The exponential distribution Exp(lambda).

This distribution has density function: f(x) = lambda * exp(-lambda * x) for x > 0.

-

Note that Exp1 is an optimised implementation for lambda = 1.

-

Methods

impl Exp[src]

pub fn new(lambda: f64) -> Exp[src]

Construct a new Exp with the given shape parameter +

Note that [Exp1][crate::distributions::Exp1] is an optimised implementation for lambda = 1.

+

Example

+
+use rand::distributions::{Exp, Distribution};
+
+let exp = Exp::new(2.0);
+let v = exp.sample(&mut rand::thread_rng());
+println!("{} is from a Exp(2) distribution", v);
+

Methods

impl Exp[src]

pub fn new(lambda: f64) -> Exp[src]

Construct a new Exp with the given shape parameter lambda. Panics if lambda <= 0.

-

Trait Implementations

impl Clone for Exp[src]

Trait Implementations

impl Clone for Exp[src]

impl Copy for Exp[src]

impl Debug for Exp[src]

impl Distribution<f64> for Exp[src]

impl Copy for Exp[src]

impl Debug for Exp[src]

impl Distribution<f64> for Exp[src]

Auto Trait Implementations

impl RefUnwindSafe for Exp

impl Send for Exp

impl Sync for Exp

impl Unpin for Exp

impl UnwindSafe for Exp

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Exp1.html b/rand/distributions/struct.Exp1.html index 2761490..395a2bd 100644 --- a/rand/distributions/struct.Exp1.html +++ b/rand/distributions/struct.Exp1.html @@ -1,18 +1,24 @@ -rand::distributions::Exp1 - Rust

[][src]Struct rand::distributions::Exp1

pub struct Exp1;
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples floating-point numbers according to the exponential distribution, +rand::distributions::Exp1 - Rust

[][src]Struct rand::distributions::Exp1

pub struct Exp1;

Samples floating-point numbers according to the exponential distribution, with rate parameter λ = 1. This is equivalent to Exp::new(1.0) or sampling with -rng.gen::<f64>().ln(), but faster.

See Exp for the general exponential distribution.

Implemented via the ZIGNOR variant1 of the Ziggurat method. The exact description in the paper was adjusted to use tables for the exponential distribution rather than normal.

+

Example

+
+use rand::prelude::*;
+use rand::distributions::Exp1;
+
+let val: f64 = SmallRng::from_entropy().sample(Exp1);
+println!("{}", val);

  1. Jurgen A. Doornik (2005). An Improved Ziggurat Method to Generate Normal Random Samples. -Nuffield College, Oxford 

Trait Implementations

impl Clone for Exp1[src]

Trait Implementations

impl Clone for Exp1[src]

impl Copy for Exp1[src]

impl Debug for Exp1[src]

impl Distribution<f64> for Exp1[src]

impl Copy for Exp1[src]

impl Debug for Exp1[src]

impl Distribution<f64> for Exp1[src]

Auto Trait Implementations

impl RefUnwindSafe for Exp1

impl Send for Exp1

impl Sync for Exp1

impl Unpin for Exp1

impl UnwindSafe for Exp1

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.FisherF.html b/rand/distributions/struct.FisherF.html index 06a4c08..f424647 100644 --- a/rand/distributions/struct.FisherF.html +++ b/rand/distributions/struct.FisherF.html @@ -1,14 +1,20 @@ -rand::distributions::FisherF - Rust

[][src]Struct rand::distributions::FisherF

pub struct FisherF { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Fisher F distribution F(m, n).

+rand::distributions::FisherF - Rust

[][src]Struct rand::distributions::FisherF

pub struct FisherF { /* fields omitted */ }

The Fisher F distribution F(m, n).

This distribution is equivalent to the ratio of two normalised chi-squared distributions, that is, F(m,n) = (χ²(m)/m) / (χ²(n)/n).

-

Methods

impl FisherF[src]

pub fn new(m: f64, n: f64) -> FisherF[src]

Create a new FisherF distribution, with the given +

Example

+
+use rand::distributions::{FisherF, Distribution};
+
+let f = FisherF::new(2.0, 32.0);
+let v = f.sample(&mut rand::thread_rng());
+println!("{} is from an F(2, 32) distribution", v)
+

Methods

impl FisherF[src]

pub fn new(m: f64, n: f64) -> FisherF[src]

Create a new FisherF distribution, with the given parameter. Panics if either m or n are not positive.

-

Trait Implementations

impl Clone for FisherF[src]

Trait Implementations

impl Clone for FisherF[src]

impl Copy for FisherF[src]

impl Debug for FisherF[src]

impl Distribution<f64> for FisherF[src]

impl Copy for FisherF[src]

impl Debug for FisherF[src]

impl Distribution<f64> for FisherF[src]

Auto Trait Implementations

impl RefUnwindSafe for FisherF

impl Send for FisherF

impl Sync for FisherF

impl Unpin for FisherF

impl UnwindSafe for FisherF

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Gamma.html b/rand/distributions/struct.Gamma.html index 117724e..ed25b1a 100644 --- a/rand/distributions/struct.Gamma.html +++ b/rand/distributions/struct.Gamma.html @@ -1,5 +1,4 @@ -rand::distributions::Gamma - Rust

[][src]Struct rand::distributions::Gamma

pub struct Gamma { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Gamma distribution Gamma(shape, scale) distribution.

+rand::distributions::Gamma - Rust

[][src]Struct rand::distributions::Gamma

pub struct Gamma { /* fields omitted */ }

The Gamma distribution Gamma(shape, scale) distribution.

The density function of this distribution is

f(x) =  x^(k - 1) * exp(-x / θ) / (Γ(k) * θ^k)
 
@@ -8,17 +7,24 @@ scale and both k and θ are strictly positive.

The algorithm used is that described by Marsaglia & Tsang 20001, falling back to directly sampling from an Exponential for shape == 1, and using the boosting technique described in that paper for shape < 1.

+

Example

+
+use rand::distributions::{Distribution, Gamma};
+
+let gamma = Gamma::new(2.0, 5.0);
+let v = gamma.sample(&mut rand::thread_rng());
+println!("{} is from a Gamma(2, 5) distribution", v);

  1. George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for Generating Gamma Variables" ACM Trans. Math. Softw. 26, 3 (September 2000), 363-372. -DOI:10.1145/358407.358414 

Methods

impl Gamma[src]

pub fn new(shape: f64, scale: f64) -> Gamma[src]

Construct an object representing the Gamma(shape, scale) +DOI:10.1145/358407.358414 

Methods

impl Gamma[src]

pub fn new(shape: f64, scale: f64) -> Gamma[src]

Construct an object representing the Gamma(shape, scale) distribution.

Panics if shape <= 0 or scale <= 0.

-

Trait Implementations

impl Clone for Gamma[src]

Trait Implementations

impl Clone for Gamma[src]

impl Copy for Gamma[src]

impl Debug for Gamma[src]

impl Distribution<f64> for Gamma[src]

impl Copy for Gamma[src]

impl Debug for Gamma[src]

impl Distribution<f64> for Gamma[src]

Auto Trait Implementations

impl RefUnwindSafe for Gamma

impl Send for Gamma

impl Sync for Gamma

impl Unpin for Gamma

impl UnwindSafe for Gamma

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.LogNormal.html b/rand/distributions/struct.LogNormal.html index de2b3af..28aaa7a 100644 --- a/rand/distributions/struct.LogNormal.html +++ b/rand/distributions/struct.LogNormal.html @@ -1,16 +1,23 @@ -rand::distributions::LogNormal - Rust

[][src]Struct rand::distributions::LogNormal

pub struct LogNormal { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The log-normal distribution ln N(mean, std_dev**2).

+rand::distributions::LogNormal - Rust

[][src]Struct rand::distributions::LogNormal

pub struct LogNormal { /* fields omitted */ }

The log-normal distribution ln N(mean, std_dev**2).

If X is log-normal distributed, then ln(X) is N(mean, std_dev**2) distributed.

-

Methods

impl LogNormal[src]

pub fn new(mean: f64, std_dev: f64) -> LogNormal[src]

Construct a new LogNormal distribution with the given mean +

Example

+
+use rand::distributions::{LogNormal, Distribution};
+
+// mean 2, standard deviation 3
+let log_normal = LogNormal::new(2.0, 3.0);
+let v = log_normal.sample(&mut rand::thread_rng());
+println!("{} is from an ln N(2, 9) distribution", v)
+

Methods

impl LogNormal[src]

pub fn new(mean: f64, std_dev: f64) -> LogNormal[src]

Construct a new LogNormal distribution with the given mean and standard deviation.

Panics

Panics if std_dev < 0.

-

Trait Implementations

impl Clone for LogNormal[src]

Trait Implementations

impl Clone for LogNormal[src]

impl Copy for LogNormal[src]

impl Debug for LogNormal[src]

impl Distribution<f64> for LogNormal[src]

impl Copy for LogNormal[src]

impl Debug for LogNormal[src]

impl Distribution<f64> for LogNormal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Normal.html b/rand/distributions/struct.Normal.html index c81f74d..5d02d13 100644 --- a/rand/distributions/struct.Normal.html +++ b/rand/distributions/struct.Normal.html @@ -1,18 +1,25 @@ -rand::distributions::Normal - Rust

[][src]Struct rand::distributions::Normal

pub struct Normal { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The normal distribution N(mean, std_dev**2).

+rand::distributions::Normal - Rust

[][src]Struct rand::distributions::Normal

pub struct Normal { /* fields omitted */ }

The normal distribution N(mean, std_dev**2).

This uses the ZIGNOR variant of the Ziggurat method, see StandardNormal for more details.

Note that StandardNormal is an optimised implementation for mean 0, and standard deviation 1.

-

Methods

impl Normal[src]

pub fn new(mean: f64, std_dev: f64) -> Normal[src]

Construct a new Normal distribution with the given mean and +

Example

+
+use rand::distributions::{Normal, Distribution};
+
+// mean 2, standard deviation 3
+let normal = Normal::new(2.0, 3.0);
+let v = normal.sample(&mut rand::thread_rng());
+println!("{} is from a N(2, 9) distribution", v)
+

Methods

impl Normal[src]

pub fn new(mean: f64, std_dev: f64) -> Normal[src]

Construct a new Normal distribution with the given mean and standard deviation.

Panics

Panics if std_dev < 0.

-

Trait Implementations

impl Clone for Normal[src]

Trait Implementations

impl Clone for Normal[src]

impl Copy for Normal[src]

impl Debug for Normal[src]

impl Distribution<f64> for Normal[src]

impl Copy for Normal[src]

impl Debug for Normal[src]

impl Distribution<f64> for Normal[src]

Auto Trait Implementations

impl RefUnwindSafe for Normal

impl Send for Normal

impl Sync for Normal

impl Unpin for Normal

impl UnwindSafe for Normal

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Open01.html b/rand/distributions/struct.Open01.html index c70e516..c66b83d 100644 --- a/rand/distributions/struct.Open01.html +++ b/rand/distributions/struct.Open01.html @@ -1,7 +1,7 @@ -rand::distributions::Open01 - Rust

[][src]Struct rand::distributions::Open01

pub struct Open01;

A distribution to sample floating point numbers uniformly in the open +rand::distributions::Open01 - Rust

[][src]Struct rand::distributions::Open01

pub struct Open01;

A distribution to sample floating point numbers uniformly in the open interval (0, 1), i.e. not including either endpoint.

All values that can be generated are of the form n * ε + ε/2. For f32 -the 23 most significant random bits of an u32 are used, for f64 52 from +the 22 most significant random bits of an u32 are used, for f64 52 from an u64. The conversion uses a transmute-based method.

See also: Standard which samples from [0, 1), OpenClosed01 which samples from (0, 1] and Uniform which samples from arbitrary @@ -13,13 +13,13 @@ ranges.

let val: f32 = thread_rng().sample(Open01); println!("f32 from (0, 1): {}", val);
-

Trait Implementations

impl Clone for Open01[src]

Trait Implementations

impl Clone for Open01[src]

impl Copy for Open01[src]

impl Debug for Open01[src]

impl Distribution<f32> for Open01[src]

impl Distribution<f64> for Open01[src]

impl Copy for Open01[src]

impl Debug for Open01[src]

impl Distribution<f32> for Open01[src]

impl Distribution<f64> for Open01[src]

Auto Trait Implementations

impl RefUnwindSafe for Open01

impl Send for Open01

impl Sync for Open01

impl Unpin for Open01

impl UnwindSafe for Open01

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + \ No newline at end of file diff --git a/rand/distributions/struct.OpenClosed01.html b/rand/distributions/struct.OpenClosed01.html index 0c38ac9..0049af8 100644 --- a/rand/distributions/struct.OpenClosed01.html +++ b/rand/distributions/struct.OpenClosed01.html @@ -1,7 +1,7 @@ -rand::distributions::OpenClosed01 - Rust

[][src]Struct rand::distributions::OpenClosed01

pub struct OpenClosed01;

A distribution to sample floating point numbers uniformly in the half-open +rand::distributions::OpenClosed01 - Rust

[][src]Struct rand::distributions::OpenClosed01

pub struct OpenClosed01;

A distribution to sample floating point numbers uniformly in the half-open interval (0, 1], i.e. including 1 but not 0.

All values that can be generated are of the form n * ε/2. For f32 -the 24 most significant random bits of a u32 are used and for f64 the +the 23 most significant random bits of a u32 are used and for f64 the 53 most significant bits of a u64 are used. The conversion uses the multiplicative method.

See also: Standard which samples from [0, 1), Open01 @@ -14,13 +14,13 @@ ranges.

let val: f32 = thread_rng().sample(OpenClosed01); println!("f32 from (0, 1): {}", val);
-

Trait Implementations

impl Clone for OpenClosed01[src]

Trait Implementations

impl Clone for OpenClosed01[src]

impl Copy for OpenClosed01[src]

impl Debug for OpenClosed01[src]

impl Distribution<f32> for OpenClosed01[src]

impl Distribution<f64> for OpenClosed01[src]

impl Copy for OpenClosed01[src]

impl Debug for OpenClosed01[src]

impl Distribution<f32> for OpenClosed01[src]

impl Distribution<f64> for OpenClosed01[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + \ No newline at end of file diff --git a/rand/distributions/struct.Pareto.html b/rand/distributions/struct.Pareto.html index 5698fb0..0f4e973 100644 --- a/rand/distributions/struct.Pareto.html +++ b/rand/distributions/struct.Pareto.html @@ -1,15 +1,21 @@ -rand::distributions::Pareto - Rust

[][src]Struct rand::distributions::Pareto

pub struct Pareto { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples floating-point numbers according to the Pareto distribution

-

Methods

impl Pareto[src]

pub fn new(scale: f64, shape: f64) -> Pareto[src]

Construct a new Pareto distribution with given scale and shape.

+rand::distributions::Pareto - Rust

[][src]Struct rand::distributions::Pareto

pub struct Pareto { /* fields omitted */ }

Samples floating-point numbers according to the Pareto distribution

+

Example

+
+use rand::prelude::*;
+use rand::distributions::Pareto;
+
+let val: f64 = SmallRng::from_entropy().sample(Pareto::new(1., 2.));
+println!("{}", val);
+

Methods

impl Pareto[src]

pub fn new(scale: f64, shape: f64) -> Pareto[src]

Construct a new Pareto distribution with given scale and shape.

In the literature, scale is commonly written as xm or k and shape is often written as α.

Panics

scale and shape have to be non-zero and positive.

-

Trait Implementations

impl Clone for Pareto[src]

Trait Implementations

impl Clone for Pareto[src]

impl Copy for Pareto[src]

impl Debug for Pareto[src]

impl Distribution<f64> for Pareto[src]

impl Copy for Pareto[src]

impl Debug for Pareto[src]

impl Distribution<f64> for Pareto[src]

Auto Trait Implementations

impl RefUnwindSafe for Pareto

impl Send for Pareto

impl Sync for Pareto

impl Unpin for Pareto

impl UnwindSafe for Pareto

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Poisson.html b/rand/distributions/struct.Poisson.html index 2f55bcd..fc49be8 100644 --- a/rand/distributions/struct.Poisson.html +++ b/rand/distributions/struct.Poisson.html @@ -1,14 +1,20 @@ -rand::distributions::Poisson - Rust

[][src]Struct rand::distributions::Poisson

pub struct Poisson { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Poisson distribution Poisson(lambda).

+rand::distributions::Poisson - Rust

[][src]Struct rand::distributions::Poisson

pub struct Poisson { /* fields omitted */ }

The Poisson distribution Poisson(lambda).

This distribution has a density function: f(k) = lambda^k * exp(-lambda) / k! for k >= 0.

-

Methods

impl Poisson[src]

pub fn new(lambda: f64) -> Poisson[src]

Construct a new Poisson with the given shape parameter +

Example

+
+use rand::distributions::{Poisson, Distribution};
+
+let poi = Poisson::new(2.0);
+let v = poi.sample(&mut rand::thread_rng());
+println!("{} is from a Poisson(2) distribution", v);
+

Methods

impl Poisson[src]

pub fn new(lambda: f64) -> Poisson[src]

Construct a new Poisson with the given shape parameter lambda. Panics if lambda <= 0.

-

Trait Implementations

impl Clone for Poisson[src]

Trait Implementations

impl Clone for Poisson[src]

impl Copy for Poisson[src]

impl Debug for Poisson[src]

impl Distribution<u64> for Poisson[src]

impl Copy for Poisson[src]

impl Debug for Poisson[src]

impl Distribution<u64> for Poisson[src]

Auto Trait Implementations

impl RefUnwindSafe for Poisson

impl Send for Poisson

impl Sync for Poisson

impl Unpin for Poisson

impl UnwindSafe for Poisson

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Standard.html b/rand/distributions/struct.Standard.html index 836e762..972ee10 100644 --- a/rand/distributions/struct.Standard.html +++ b/rand/distributions/struct.Standard.html @@ -1,7 +1,7 @@ -rand::distributions::Standard - Rust

[][src]Struct rand::distributions::Standard

pub struct Standard;

A generic random value distribution, implemented for many primitive types. +rand::distributions::Standard - Rust

[][src]Struct rand::distributions::Standard

pub struct Standard;

A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.

-

Provided implementations

+

Built-in Implementations

Assuming the provided Rng is well-behaved, these implementations generate values with the following ranges and distributions:

    @@ -17,44 +17,26 @@ half-open range [0, 1). See notes below.
  • Wrapping integers (Wrapping<T>), besides the type identical to their normal integer variants.
-

The Standard distribution also supports generation of the following -compound types where all component types are supported:

+

The following aggregate types also implement the distribution Standard as +long as their component types implement it:

    -
  • Tuples (up to 12 elements): each element is generated sequentially.
  • -
  • Arrays (up to 32 elements): each element is generated sequentially; -see also [Rng::fill] which supports arbitrary array length for integer -types and tends to be faster for u32 and smaller types.
  • -
  • Option<T> first generates a bool, and if true generates and returns -Some(value) where value: T, otherwise returning None.
  • +
  • Tuples and arrays: Each element of the tuple or array is generated +independently, using the Standard distribution recursively.
  • +
  • Option<T> where Standard is implemented for T: Returns None with +probability 0.5; otherwise generates a random x: T and returns Some(x).
-

Custom implementations

-

The [Standard] distribution may be implemented for user types as follows:

- -
-use rand::Rng;
-use rand::distributions::{Distribution, Standard};
-
-struct MyF32 {
-    x: f32,
-}
-
-impl Distribution<MyF32> for Standard {
-    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
-        MyF32 { x: rng.gen() }
-    }
-}
-

Example usage

+

Example

 use rand::prelude::*;
 use rand::distributions::Standard;
 
-let val: f32 = StdRng::from_entropy().sample(Standard);
+let val: f32 = SmallRng::from_entropy().sample(Standard);
 println!("f32 from [0, 1): {}", val);

Floating point implementation

The floating point implementations for Standard generate a random value in the half-open interval [0, 1), i.e. including 0 but not 1.

All values that can be generated are of the form n * ε/2. For f32 -the 24 most significant random bits of a u32 are used and for f64 the +the 23 most significant random bits of a u32 are used and for f64 the 53 most significant bits of a u64 are used. The conversion uses the multiplicative method: (rng.gen::<$uty>() >> N) as $ty * (ε/2).

See also: [Open01] which samples from (0, 1), [OpenClosed01] which @@ -63,149 +45,137 @@ samples from (0, 1] and Rng::gen_range(0, 1) which als transmute-based methods which yield 1 bit less precision but may perform faster on some architectures (on modern Intel CPUs all methods have approximately equal performance).

-

Trait Implementations

impl Clone for Standard[src]

Trait Implementations

impl Clone for Standard[src]

impl Copy for Standard[src]

impl Debug for Standard[src]

impl<T> Distribution<[T; 0]> for Standard[src]

impl<T> Distribution<[T; 1]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 10]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 11]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 12]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 13]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 14]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 15]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 16]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 17]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 18]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 19]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 2]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 20]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 21]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 22]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 23]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 24]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 25]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 26]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 27]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 28]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 29]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 3]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 30]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 31]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 32]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 4]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 5]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 6]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 7]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 8]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 9]> for Standard where
    Standard: Distribution<T>, 
[src]

impl Distribution<()> for Standard[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>,
    Standard: Distribution<L>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>, 
[src]

impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>, 
[src]

impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>, 
[src]

impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>, 
[src]

impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>, 
[src]

impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>, 
[src]

impl<A, B, C, D> Distribution<(A, B, C, D)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>, 
[src]

impl<A, B, C> Distribution<(A, B, C)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>, 
[src]

impl<A, B> Distribution<(A, B)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>, 
[src]

impl<A> Distribution<(A,)> for Standard where
    Standard: Distribution<A>, 
[src]

impl Distribution<NonZeroU128> for Standard[src]

impl Distribution<NonZeroU16> for Standard[src]

impl Distribution<NonZeroU32> for Standard[src]

impl Distribution<NonZeroU64> for Standard[src]

impl Distribution<NonZeroU8> for Standard[src]

impl Distribution<NonZeroUsize> for Standard[src]

impl<T> Distribution<Option<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<Wrapping<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl Distribution<bool> for Standard[src]

impl Distribution<char> for Standard[src]

impl Distribution<f32> for Standard[src]

impl Distribution<f64> for Standard[src]

impl Copy for Standard[src]

impl Debug for Standard[src]

impl<T> Distribution<[T; 0]> for Standard[src]

impl<T> Distribution<[T; 1]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 10]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 11]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 12]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 13]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 14]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 15]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 16]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 17]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 18]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 19]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 2]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 20]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 21]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 22]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 23]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 24]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 25]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 26]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 27]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 28]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 29]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 3]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 30]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 31]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 32]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 4]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 5]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 6]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 7]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 8]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 9]> for Standard where
    Standard: Distribution<T>, 
[src]

impl Distribution<()> for Standard[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>,
    Standard: Distribution<L>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>, 
[src]

impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>, 
[src]

impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>, 
[src]

impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>, 
[src]

impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>, 
[src]

impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>, 
[src]

impl<A, B, C, D> Distribution<(A, B, C, D)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>, 
[src]

impl<A, B, C> Distribution<(A, B, C)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>, 
[src]

impl<A, B> Distribution<(A, B)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>, 
[src]

impl<A> Distribution<(A,)> for Standard where
    Standard: Distribution<A>, 
[src]

impl<T> Distribution<Option<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<Wrapping<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl Distribution<bool> for Standard[src]

impl Distribution<char> for Standard[src]

impl Distribution<f32> for Standard[src]

impl Distribution<f64> for Standard[src]

impl Distribution<i128> for Standard[src]

impl Distribution<i16> for Standard[src]

impl Distribution<i32> for Standard[src]

impl Distribution<i64> for Standard[src]

impl Distribution<i8> for Standard[src]

impl Distribution<isize> for Standard[src]

impl Distribution<u128> for Standard[src]

impl Distribution<u16> for Standard[src]

impl Distribution<u32> for Standard[src]

impl Distribution<u64> for Standard[src]

impl Distribution<u8> for Standard[src]

impl Distribution<usize> for Standard[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.StandardNormal.html b/rand/distributions/struct.StandardNormal.html index adf4e4a..c226364 100644 --- a/rand/distributions/struct.StandardNormal.html +++ b/rand/distributions/struct.StandardNormal.html @@ -1,16 +1,22 @@ -rand::distributions::StandardNormal - Rust

[][src]Struct rand::distributions::StandardNormal

pub struct StandardNormal;
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples floating-point numbers according to the normal distribution +rand::distributions::StandardNormal - Rust

[][src]Struct rand::distributions::StandardNormal

pub struct StandardNormal;

Samples floating-point numbers according to the normal distribution N(0, 1) (a.k.a. a standard normal, or Gaussian). This is equivalent to Normal::new(0.0, 1.0) but faster.

See Normal for the general normal distribution.

Implemented via the ZIGNOR variant1 of the Ziggurat method.

+

Example

+
+use rand::prelude::*;
+use rand::distributions::StandardNormal;
+
+let val: f64 = SmallRng::from_entropy().sample(StandardNormal);
+println!("{}", val);

  1. Jurgen A. Doornik (2005). An Improved Ziggurat Method to Generate Normal Random Samples. -Nuffield College, Oxford 

Trait Implementations

impl Clone for StandardNormal[src]

Trait Implementations

impl Clone for StandardNormal[src]

impl Copy for StandardNormal[src]

impl Debug for StandardNormal[src]

impl Distribution<f64> for StandardNormal[src]

impl Copy for StandardNormal[src]

impl Debug for StandardNormal[src]

impl Distribution<f64> for StandardNormal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.StudentT.html b/rand/distributions/struct.StudentT.html index f515e1b..9f389a6 100644 --- a/rand/distributions/struct.StudentT.html +++ b/rand/distributions/struct.StudentT.html @@ -1,13 +1,19 @@ -rand::distributions::StudentT - Rust

[][src]Struct rand::distributions::StudentT

pub struct StudentT { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The Student t distribution, t(nu), where nu is the degrees of +rand::distributions::StudentT - Rust

[][src]Struct rand::distributions::StudentT

pub struct StudentT { /* fields omitted */ }

The Student t distribution, t(nu), where nu is the degrees of freedom.

-

Methods

impl StudentT[src]

pub fn new(n: f64) -> StudentT[src]

Create a new Student t distribution with n degrees of +

Example

+
+use rand::distributions::{StudentT, Distribution};
+
+let t = StudentT::new(11.0);
+let v = t.sample(&mut rand::thread_rng());
+println!("{} is from a t(11) distribution", v)
+

Methods

impl StudentT[src]

pub fn new(n: f64) -> StudentT[src]

Create a new Student t distribution with n degrees of freedom. Panics if n <= 0.

-

Trait Implementations

impl Clone for StudentT[src]

Trait Implementations

impl Clone for StudentT[src]

impl Copy for StudentT[src]

impl Debug for StudentT[src]

impl Distribution<f64> for StudentT[src]

impl Copy for StudentT[src]

impl Debug for StudentT[src]

impl Distribution<f64> for StudentT[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Triangular.html b/rand/distributions/struct.Triangular.html index 0057c94..67ed5d4 100644 --- a/rand/distributions/struct.Triangular.html +++ b/rand/distributions/struct.Triangular.html @@ -1,14 +1,20 @@ -rand::distributions::Triangular - Rust

[][src]Struct rand::distributions::Triangular

pub struct Triangular { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

The triangular distribution.

-

Methods

impl Triangular[src]

pub fn new(min: f64, max: f64, mode: f64) -> Triangular[src]

Construct a new Triangular with minimum min, maximum max and mode +rand::distributions::Triangular - Rust

[][src]Struct rand::distributions::Triangular

pub struct Triangular { /* fields omitted */ }

The triangular distribution.

+

Example

+
+use rand::distributions::{Triangular, Distribution};
+
+let d = Triangular::new(0., 5., 2.5);
+let v = d.sample(&mut rand::thread_rng());
+println!("{} is from a triangular distribution", v);
+

Methods

impl Triangular[src]

pub fn new(min: f64, max: f64, mode: f64) -> Triangular[src]

Construct a new Triangular with minimum min, maximum max and mode mode.

Panics

If max < mode, mode < max or max == min.

-

Trait Implementations

impl Clone for Triangular[src]

Trait Implementations

impl Clone for Triangular[src]

impl Copy for Triangular[src]

impl Debug for Triangular[src]

impl Distribution<f64> for Triangular[src]

impl Copy for Triangular[src]

impl Debug for Triangular[src]

impl Distribution<f64> for Triangular[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Uniform.html b/rand/distributions/struct.Uniform.html index e0bec7d..edd2745 100644 --- a/rand/distributions/struct.Uniform.html +++ b/rand/distributions/struct.Uniform.html @@ -1,4 +1,4 @@ -rand::distributions::Uniform - Rust

[][src]Struct rand::distributions::Uniform

pub struct Uniform<X: SampleUniform>(_);

Sample values uniformly between two bounds.

+rand::distributions::Uniform - Rust

[][src]Struct rand::distributions::Uniform

pub struct Uniform<X: SampleUniform> { /* fields omitted */ }

Sample values uniformly between two bounds.

[Uniform::new] and [Uniform::new_inclusive] construct a uniform distribution sampling from the given range; these functions may do extra work up front to make sampling of multiple values faster.

@@ -28,17 +28,17 @@ be taken to ensure that rounding never results values < low or < } println!("{}", sum); }
-

Methods

impl<X: SampleUniform> Uniform<X>[src]

pub fn new<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the half +

Methods

impl<X: SampleUniform> Uniform<X>[src]

pub fn new<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the half open range [low, high) (excluding high). Panics if low >= high.

-

pub fn new_inclusive<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the closed +

pub fn new_inclusive<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the closed range [low, high] (inclusive). Panics if low > high.

-

Trait Implementations

impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
[src]

Trait Implementations

impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
[src]

impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
[src]

impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

impl<X: SampleUniform> From<Range<X>> for Uniform<X>[src]

impl<X: SampleUniform> From<RangeInclusive<X>> for Uniform<X>[src]

impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
[src]

impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

impl<X: SampleUniform> From<Range<X>> for Uniform<X>[src]

impl<X: SampleUniform> From<RangeInclusive<X>> for Uniform<X>[src]

Auto Trait Implementations

impl<X> RefUnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: RefUnwindSafe

impl<X> Send for Uniform<X> where
    <X as SampleUniform>::Sampler: Send

impl<X> Sync for Uniform<X> where
    <X as SampleUniform>::Sampler: Sync

impl<X> Unpin for Uniform<X> where
    <X as SampleUniform>::Sampler: Unpin

impl<X> UnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + \ No newline at end of file diff --git a/rand/distributions/struct.UnitCircle.html b/rand/distributions/struct.UnitCircle.html index 6772ec5..1fe67b9 100644 --- a/rand/distributions/struct.UnitCircle.html +++ b/rand/distributions/struct.UnitCircle.html @@ -1,15 +1,21 @@ -rand::distributions::UnitCircle - Rust

[][src]Struct rand::distributions::UnitCircle

pub struct UnitCircle;
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples uniformly from the edge of the unit circle in two dimensions.

+rand::distributions::UnitCircle - Rust

[][src]Struct rand::distributions::UnitCircle

pub struct UnitCircle;

Samples uniformly from the edge of the unit circle in two dimensions.

Implemented via a method by von Neumann1.

+

Example

+
+use rand::distributions::{UnitCircle, Distribution};
+
+let circle = UnitCircle::new();
+let v = circle.sample(&mut rand::thread_rng());
+println!("{:?} is from the unit circle.", v)

  1. von Neumann, J. (1951) Various Techniques Used in Connection with Random Digits. NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing -Office, pp. 36-38. 

Methods

impl UnitCircle[src]

pub fn new() -> UnitCircle[src]

Construct a new UnitCircle distribution.

-

Trait Implementations

impl Clone for UnitCircle[src]

Methods

impl UnitCircle[src]

pub fn new() -> UnitCircle[src]

Construct a new UnitCircle distribution.

+

Trait Implementations

impl Clone for UnitCircle[src]

impl Copy for UnitCircle[src]

impl Debug for UnitCircle[src]

impl Distribution<[f64; 2]> for UnitCircle[src]

impl Copy for UnitCircle[src]

impl Debug for UnitCircle[src]

impl Distribution<[f64; 2]> for UnitCircle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.UnitSphereSurface.html b/rand/distributions/struct.UnitSphereSurface.html index c41fa2c..74cb00b 100644 --- a/rand/distributions/struct.UnitSphereSurface.html +++ b/rand/distributions/struct.UnitSphereSurface.html @@ -1,14 +1,20 @@ -rand::distributions::UnitSphereSurface - Rust

[][src]Struct rand::distributions::UnitSphereSurface

pub struct UnitSphereSurface;
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples uniformly from the surface of the unit sphere in three dimensions.

+rand::distributions::UnitSphereSurface - Rust

[][src]Struct rand::distributions::UnitSphereSurface

pub struct UnitSphereSurface;

Samples uniformly from the surface of the unit sphere in three dimensions.

Implemented via a method by Marsaglia1.

+

Example

+
+use rand::distributions::{UnitSphereSurface, Distribution};
+
+let sphere = UnitSphereSurface::new();
+let v = sphere.sample(&mut rand::thread_rng());
+println!("{:?} is from the unit sphere surface.", v)

  1. Marsaglia, George (1972). Choosing a Point from the Surface of a Sphere. -Ann. Math. Statist. 43, no. 2, 645--646. 

Methods

impl UnitSphereSurface[src]

pub fn new() -> UnitSphereSurface[src]

Construct a new UnitSphereSurface distribution.

-

Trait Implementations

impl Clone for UnitSphereSurface[src]

Methods

impl UnitSphereSurface[src]

pub fn new() -> UnitSphereSurface[src]

Construct a new UnitSphereSurface distribution.

+

Trait Implementations

impl Clone for UnitSphereSurface[src]

impl Copy for UnitSphereSurface[src]

impl Debug for UnitSphereSurface[src]

impl Distribution<[f64; 3]> for UnitSphereSurface[src]

impl Copy for UnitSphereSurface[src]

impl Debug for UnitSphereSurface[src]

impl Distribution<[f64; 3]> for UnitSphereSurface[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/struct.Weibull.html b/rand/distributions/struct.Weibull.html index 3090f9b..140c70e 100644 --- a/rand/distributions/struct.Weibull.html +++ b/rand/distributions/struct.Weibull.html @@ -1,13 +1,19 @@ -rand::distributions::Weibull - Rust

[][src]Struct rand::distributions::Weibull

pub struct Weibull { /* fields omitted */ }
Deprecated since 0.7.0:

moved to rand_distr crate

-

Samples floating-point numbers according to the Weibull distribution

-

Methods

impl Weibull[src]

pub fn new(scale: f64, shape: f64) -> Weibull[src]

Construct a new Weibull distribution with given scale and shape.

+rand::distributions::Weibull - Rust

[][src]Struct rand::distributions::Weibull

pub struct Weibull { /* fields omitted */ }

Samples floating-point numbers according to the Weibull distribution

+

Example

+
+use rand::prelude::*;
+use rand::distributions::Weibull;
+
+let val: f64 = SmallRng::from_entropy().sample(Weibull::new(1., 10.));
+println!("{}", val);
+

Methods

impl Weibull[src]

pub fn new(scale: f64, shape: f64) -> Weibull[src]

Construct a new Weibull distribution with given scale and shape.

Panics

scale and shape have to be non-zero and positive.

-

Trait Implementations

impl Clone for Weibull[src]

Trait Implementations

impl Clone for Weibull[src]

impl Copy for Weibull[src]

impl Debug for Weibull[src]

impl Distribution<f64> for Weibull[src]

impl Copy for Weibull[src]

impl Debug for Weibull[src]

impl Distribution<f64> for Weibull[src]

Auto Trait Implementations

impl RefUnwindSafe for Weibull

impl Send for Weibull

impl Sync for Weibull

impl Unpin for Weibull

impl UnwindSafe for Weibull

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/trait.Distribution.html b/rand/distributions/trait.Distribution.html index 4c07572..39d1ca8 100644 --- a/rand/distributions/trait.Distribution.html +++ b/rand/distributions/trait.Distribution.html @@ -1,7 +1,7 @@ -rand::distributions::Distribution - Rust

[][src]Trait rand::distributions::Distribution

pub trait Distribution<T> {
+rand::distributions::Distribution - Rust

[][src]Trait rand::distributions::Distribution

pub trait Distribution<T> {
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T;
 
-    fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
    where
        R: Rng,
        Self: Sized
, + fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>
    where
        Self: Sized,
        R: Rng
, { ... } }

Types (distributions) that can be used to create a random instance of T.

It is possible to sample from a distribution through both the @@ -11,40 +11,30 @@ produces an iterator that samples from the distribution.

All implementations are expected to be immutable; this has the significant advantage of not needing to consider thread safety, and for most distributions efficient state-less sampling algorithms are available.

-

Implementations are typically expected to be portable with reproducible -results when used with a PRNG with fixed seed; see the -portability chapter -of The Rust Rand Book. In some cases this does not apply, e.g. the usize -type requires different sampling on 32-bit and 64-bit machines.

Required methods

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T

Generate a random value of T, using rng as the source of randomness.

Loading content... -

Provided methods

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
    R: Rng,
    Self: Sized

Create an iterator that generates random values of T, using rng as +

Provided methods

fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
    Self: Sized,
    R: Rng

Create an iterator that generates random values of T, using rng as the source of randomness.

-

Note that this function takes self by value. This works since -Distribution<T> is impl'd for &D where D: Distribution<T>, -however borrowing is not automatic hence distr.sample_iter(...) may -need to be replaced with (&distr).sample_iter(...) to borrow or -(&*distr).sample_iter(...) to reborrow an existing reference.

Example

 use rand::thread_rng;
 use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard};
 
-let rng = thread_rng();
+let mut rng = thread_rng();
 
 // Vec of 16 x f32:
-let v: Vec<f32> = Standard.sample_iter(rng).take(16).collect();
+let v: Vec<f32> = Standard.sample_iter(&mut rng).take(16).collect();
 
 // String:
-let s: String = Alphanumeric.sample_iter(rng).take(7).collect();
+let s: String = Alphanumeric.sample_iter(&mut rng).take(7).collect();
 
 // Dice-rolling:
 let die_range = Uniform::new_inclusive(1, 6);
-let mut roll_die = die_range.sample_iter(rng);
+let mut roll_die = die_range.sample_iter(&mut rng);
 while roll_die.next().unwrap() != 6 {
     println!("Not a 6; rolling again!");
 }
Loading content... -

Implementations on Foreign Types

impl<'a, T, D: Distribution<T>> Distribution<T> for &'a D[src]

Loading content... -

Implementors

impl Distribution<[f64; 2]> for UnitCircle[src]

impl Distribution<[f64; 3]> for UnitSphereSurface[src]

impl Distribution<bool> for Bernoulli[src]

impl Distribution<bool> for Standard[src]

impl Distribution<char> for Alphanumeric[src]

impl Distribution<char> for Standard[src]

impl Distribution<f32> for Standard[src]

impl Distribution<f32> for Open01[src]

impl Distribution<f32> for OpenClosed01[src]

impl Distribution<f64> for Cauchy[src]

impl Distribution<f64> for Exp[src]

impl Distribution<f64> for Gamma[src]

impl Distribution<f64> for ChiSquared[src]

impl Distribution<f64> for FisherF[src]

impl Distribution<f64> for StudentT[src]

impl Distribution<f64> for Beta[src]

impl Distribution<f64> for StandardNormal[src]

impl Distribution<f64> for Normal[src]

impl Distribution<f64> for LogNormal[src]

impl Distribution<f64> for Pareto[src]

impl Distribution<f64> for Triangular[src]

impl Distribution<f64> for Weibull[src]

impl Distribution<f64> for Standard[src]

impl Distribution<f64> for Exp1[src]

impl Distribution<f64> for Open01[src]

impl Distribution<f64> for OpenClosed01[src]

impl Distribution<i128> for Standard[src]

impl Distribution<i16> for Standard[src]

impl Distribution<i32> for Standard[src]

impl Distribution<i64> for Standard[src]

impl Distribution<i8> for Standard[src]

impl Distribution<isize> for Standard[src]

impl Distribution<u128> for Standard[src]

impl Distribution<u16> for Standard[src]

impl Distribution<u32> for Standard[src]

impl Distribution<u64> for Binomial[src]

impl Distribution<u64> for Poisson[src]

impl Distribution<u64> for Standard[src]

impl Distribution<u8> for Standard[src]

impl Distribution<()> for Standard[src]

impl Distribution<usize> for Standard[src]

impl Distribution<Vec<f64>> for Dirichlet[src]

impl Distribution<NonZeroU128> for Standard[src]

impl Distribution<NonZeroU16> for Standard[src]

impl Distribution<NonZeroU32> for Standard[src]

impl Distribution<NonZeroU64> for Standard[src]

impl Distribution<NonZeroU8> for Standard[src]

impl Distribution<NonZeroUsize> for Standard[src]

impl<A> Distribution<(A,)> for Standard where
    Standard: Distribution<A>, 
[src]

impl<A, B> Distribution<(A, B)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>, 
[src]

impl<A, B, C> Distribution<(A, B, C)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>, 
[src]

impl<A, B, C, D> Distribution<(A, B, C, D)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>, 
[src]

impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>, 
[src]

impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>, 
[src]

impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>, 
[src]

impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>, 
[src]

impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>,
    Standard: Distribution<L>, 
[src]

impl<T> Distribution<Option<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 0]> for Standard[src]

impl<T> Distribution<[T; 1]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 2]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 3]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 4]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 5]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 6]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 7]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 8]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 9]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 10]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 11]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 12]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 13]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 14]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 15]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 16]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 17]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 18]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 19]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 20]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 21]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 22]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 23]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 24]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 25]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 26]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 27]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 28]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 29]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 30]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 31]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 32]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<Wrapping<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<W: Weight> Distribution<usize> for rand::distributions::weighted::alias_method::WeightedIndex<W>[src]

impl<X> Distribution<usize> for rand::distributions::weighted::WeightedIndex<X> where
    X: SampleUniform + PartialOrd
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

Loading content...
\ No newline at end of file +

Implementations on Foreign Types

impl<'a, T, D: Distribution<T>> Distribution<T> for &'a D[src]

Loading content... +

Implementors

impl Distribution<[f64; 2]> for UnitCircle[src]

impl Distribution<[f64; 3]> for UnitSphereSurface[src]

impl Distribution<bool> for Bernoulli[src]

impl Distribution<bool> for Standard[src]

impl Distribution<char> for Alphanumeric[src]

impl Distribution<char> for Standard[src]

impl Distribution<f32> for Standard[src]

impl Distribution<f32> for Open01[src]

impl Distribution<f32> for OpenClosed01[src]

impl Distribution<f64> for Gamma[src]

impl Distribution<f64> for ChiSquared[src]

impl Distribution<f64> for FisherF[src]

impl Distribution<f64> for StudentT[src]

impl Distribution<f64> for Beta[src]

impl Distribution<f64> for StandardNormal[src]

impl Distribution<f64> for Normal[src]

impl Distribution<f64> for LogNormal[src]

impl Distribution<f64> for Exp[src]

impl Distribution<f64> for Pareto[src]

impl Distribution<f64> for Cauchy[src]

impl Distribution<f64> for Triangular[src]

impl Distribution<f64> for Weibull[src]

impl Distribution<f64> for Standard[src]

impl Distribution<f64> for Exp1[src]

impl Distribution<f64> for Open01[src]

impl Distribution<f64> for OpenClosed01[src]

impl Distribution<i128> for Standard[src]

impl Distribution<i16> for Standard[src]

impl Distribution<i32> for Standard[src]

impl Distribution<i64> for Standard[src]

impl Distribution<i8> for Standard[src]

impl Distribution<isize> for Standard[src]

impl Distribution<u128> for Standard[src]

impl Distribution<u16> for Standard[src]

impl Distribution<u32> for Standard[src]

impl Distribution<u64> for Poisson[src]

impl Distribution<u64> for Binomial[src]

impl Distribution<u64> for Standard[src]

impl Distribution<u8> for Standard[src]

impl Distribution<()> for Standard[src]

impl Distribution<usize> for Standard[src]

impl Distribution<Vec<f64>> for Dirichlet[src]

impl<'a, T: Clone> Distribution<T> for WeightedChoice<'a, T>[src]

impl<A> Distribution<(A,)> for Standard where
    Standard: Distribution<A>, 
[src]

impl<A, B> Distribution<(A, B)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>, 
[src]

impl<A, B, C> Distribution<(A, B, C)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>, 
[src]

impl<A, B, C, D> Distribution<(A, B, C, D)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>, 
[src]

impl<A, B, C, D, E> Distribution<(A, B, C, D, E)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>, 
[src]

impl<A, B, C, D, E, F> Distribution<(A, B, C, D, E, F)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>, 
[src]

impl<A, B, C, D, E, F, G> Distribution<(A, B, C, D, E, F, G)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>, 
[src]

impl<A, B, C, D, E, F, G, H> Distribution<(A, B, C, D, E, F, G, H)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>, 
[src]

impl<A, B, C, D, E, F, G, H, I> Distribution<(A, B, C, D, E, F, G, H, I)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J> Distribution<(A, B, C, D, E, F, G, H, I, J)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K> Distribution<(A, B, C, D, E, F, G, H, I, J, K)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L> Distribution<(A, B, C, D, E, F, G, H, I, J, K, L)> for Standard where
    Standard: Distribution<A>,
    Standard: Distribution<B>,
    Standard: Distribution<C>,
    Standard: Distribution<D>,
    Standard: Distribution<E>,
    Standard: Distribution<F>,
    Standard: Distribution<G>,
    Standard: Distribution<H>,
    Standard: Distribution<I>,
    Standard: Distribution<J>,
    Standard: Distribution<K>,
    Standard: Distribution<L>, 
[src]

impl<T> Distribution<Option<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 0]> for Standard[src]

impl<T> Distribution<[T; 1]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 2]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 3]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 4]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 5]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 6]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 7]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 8]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 9]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 10]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 11]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 12]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 13]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 14]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 15]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 16]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 17]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 18]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 19]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 20]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 21]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 22]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 23]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 24]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 25]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 26]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 27]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 28]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 29]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 30]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 31]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<[T; 32]> for Standard where
    Standard: Distribution<T>, 
[src]

impl<T> Distribution<Wrapping<T>> for Standard where
    Standard: Distribution<T>, 
[src]

impl<X> Distribution<usize> for WeightedIndex<X> where
    X: SampleUniform + PartialOrd
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

Loading content...
\ No newline at end of file diff --git a/rand/distributions/uniform/index.html b/rand/distributions/uniform/index.html index 6ad1e17..f025451 100644 --- a/rand/distributions/uniform/index.html +++ b/rand/distributions/uniform/index.html @@ -1,4 +1,4 @@ -rand::distributions::uniform - Rust

[][src]Module rand::distributions::uniform

A distribution uniformly sampling numbers within a given range.

+rand::distributions::uniform - Rust

[][src]Module rand::distributions::uniform

A distribution uniformly sampling numbers within a given range.

[Uniform] is the standard distribution to sample uniformly from a range; e.g. Uniform::new_inclusive(1, 6) can sample integers from 1 to 6, like a standard die. [Rng::gen_range] supports any type supported by @@ -47,7 +47,9 @@ to copy or clone the value, whatever is appropriate for your type.

struct MyF32(f32); #[derive(Clone, Copy, Debug)] -struct UniformMyF32(UniformFloat<f32>); +struct UniformMyF32 { + inner: UniformFloat<f32>, +} impl UniformSampler for UniformMyF32 { type X = MyF32; @@ -55,7 +57,9 @@ to copy or clone the value, whatever is appropriate for your type.

where B1: SampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized { - UniformMyF32(UniformFloat::<f32>::new(low.borrow().0, high.borrow().0)) + UniformMyF32 { + inner: UniformFloat::<f32>::new(low.borrow().0, high.borrow().0), + } } fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self where B1: SampleBorrow<Self::X> + Sized, @@ -64,7 +68,7 @@ to copy or clone the value, whatever is appropriate for your type.

UniformSampler::new(low, high) } fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X { - MyF32(self.0.sample(rng)) + MyF32(self.inner.sample(rng)) } } diff --git a/rand/distributions/uniform/struct.Uniform.html b/rand/distributions/uniform/struct.Uniform.html index 2ce8413..c8759c0 100644 --- a/rand/distributions/uniform/struct.Uniform.html +++ b/rand/distributions/uniform/struct.Uniform.html @@ -1,4 +1,4 @@ -rand::distributions::uniform::Uniform - Rust

[][src]Struct rand::distributions::uniform::Uniform

pub struct Uniform<X: SampleUniform>(_);

Sample values uniformly between two bounds.

+rand::distributions::uniform::Uniform - Rust

[][src]Struct rand::distributions::uniform::Uniform

pub struct Uniform<X: SampleUniform> { /* fields omitted */ }

Sample values uniformly between two bounds.

[Uniform::new] and [Uniform::new_inclusive] construct a uniform distribution sampling from the given range; these functions may do extra work up front to make sampling of multiple values faster.

@@ -28,17 +28,17 @@ be taken to ensure that rounding never results values < low or < } println!("{}", sum); }
-

Methods

impl<X: SampleUniform> Uniform<X>[src]

pub fn new<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the half +

Methods

impl<X: SampleUniform> Uniform<X>[src]

pub fn new<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the half open range [low, high) (excluding high). Panics if low >= high.

-

pub fn new_inclusive<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the closed +

pub fn new_inclusive<B1, B2>(low: B1, high: B2) -> Uniform<X> where
    B1: SampleBorrow<X> + Sized,
    B2: SampleBorrow<X> + Sized
[src]

Create a new Uniform instance which samples uniformly from the closed range [low, high] (inclusive). Panics if low > high.

-

Trait Implementations

impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
[src]

Trait Implementations

impl<X: Clone + SampleUniform> Clone for Uniform<X> where
    X::Sampler: Clone
[src]

impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
[src]

impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

impl<X: SampleUniform> From<Range<X>> for Uniform<X>[src]

impl<X: SampleUniform> From<RangeInclusive<X>> for Uniform<X>[src]

impl<X: Copy + SampleUniform> Copy for Uniform<X> where
    X::Sampler: Copy
[src]

impl<X: Debug + SampleUniform> Debug for Uniform<X> where
    X::Sampler: Debug
[src]

impl<X: SampleUniform> Distribution<X> for Uniform<X>[src]

impl<X: SampleUniform> From<Range<X>> for Uniform<X>[src]

impl<X: SampleUniform> From<RangeInclusive<X>> for Uniform<X>[src]

Auto Trait Implementations

impl<X> RefUnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: RefUnwindSafe

impl<X> Send for Uniform<X> where
    <X as SampleUniform>::Sampler: Send

impl<X> Sync for Uniform<X> where
    <X as SampleUniform>::Sampler: Sync

impl<X> Unpin for Uniform<X> where
    <X as SampleUniform>::Sampler: Unpin

impl<X> UnwindSafe for Uniform<X> where
    <X as SampleUniform>::Sampler: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/uniform/struct.UniformDuration.html b/rand/distributions/uniform/struct.UniformDuration.html index fd2f0d2..1c69236 100644 --- a/rand/distributions/uniform/struct.UniformDuration.html +++ b/rand/distributions/uniform/struct.UniformDuration.html @@ -1,14 +1,14 @@ -rand::distributions::uniform::UniformDuration - Rust

[][src]Struct rand::distributions::uniform::UniformDuration

pub struct UniformDuration { /* fields omitted */ }

The back-end implementing [UniformSampler] for Duration.

+rand::distributions::uniform::UniformDuration - Rust

[][src]Struct rand::distributions::uniform::UniformDuration

pub struct UniformDuration { /* fields omitted */ }

The back-end implementing [UniformSampler] for Duration.

Unless you are implementing [UniformSampler] for your own types, this type should not be used directly, use [Uniform] instead.

-

Trait Implementations

impl Clone for UniformDuration[src]

Trait Implementations

impl Clone for UniformDuration[src]

impl Copy for UniformDuration[src]

impl Debug for UniformDuration[src]

impl UniformSampler for UniformDuration[src]

type X = Duration

The type sampled by this implementation.

-

impl Copy for UniformDuration[src]

impl Debug for UniformDuration[src]

impl UniformSampler for UniformDuration[src]

type X = Duration

The type sampled by this implementation.

+

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/uniform/struct.UniformFloat.html b/rand/distributions/uniform/struct.UniformFloat.html index 03be1c9..ae66361 100644 --- a/rand/distributions/uniform/struct.UniformFloat.html +++ b/rand/distributions/uniform/struct.UniformFloat.html @@ -1,4 +1,4 @@ -rand::distributions::uniform::UniformFloat - Rust

[][src]Struct rand::distributions::uniform::UniformFloat

pub struct UniformFloat<X> { /* fields omitted */ }

The back-end implementing [UniformSampler] for floating-point types.

+rand::distributions::uniform::UniformFloat - Rust

[][src]Struct rand::distributions::uniform::UniformFloat

pub struct UniformFloat<X> { /* fields omitted */ }

The back-end implementing [UniformSampler] for floating-point types.

Unless you are implementing [UniformSampler] for your own type, this type should not be used directly, use [Uniform] instead.

Implementation notes

@@ -7,21 +7,21 @@ should not be used directly, use [Uniform] instead.

way one or two steps can be optimized out.

The floats are first converted to a value in the [1, 2) interval using a transmute-based method, and then mapped to the expected range with a -multiply and addition. Values produced this way have what equals 23 bits of +multiply and addition. Values produced this way have what equals 22 bits of random digits for an f32, and 52 for an f64.

-

Trait Implementations

impl<X: Clone> Clone for UniformFloat<X>[src]

Trait Implementations

impl<X: Clone> Clone for UniformFloat<X>[src]

impl<X: Copy> Copy for UniformFloat<X>[src]

impl<X: Debug> Debug for UniformFloat<X>[src]

impl UniformSampler for UniformFloat<f32>[src]

type X = f32

The type sampled by this implementation.

-

impl UniformSampler for UniformFloat<f64>[src]

type X = f64

The type sampled by this implementation.

-

impl<X: Copy> Copy for UniformFloat<X>[src]

impl<X: Debug> Debug for UniformFloat<X>[src]

impl UniformSampler for UniformFloat<f32>[src]

type X = f32

The type sampled by this implementation.

+

impl UniformSampler for UniformFloat<f64>[src]

type X = f64

The type sampled by this implementation.

+

Auto Trait Implementations

impl<X> RefUnwindSafe for UniformFloat<X> where
    X: RefUnwindSafe

impl<X> Send for UniformFloat<X> where
    X: Send

impl<X> Sync for UniformFloat<X> where
    X: Sync

impl<X> Unpin for UniformFloat<X> where
    X: Unpin

impl<X> UnwindSafe for UniformFloat<X> where
    X: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/uniform/struct.UniformInt.html b/rand/distributions/uniform/struct.UniformInt.html index 869bbb1..e89be11 100644 --- a/rand/distributions/uniform/struct.UniformInt.html +++ b/rand/distributions/uniform/struct.UniformInt.html @@ -1,92 +1,95 @@ -rand::distributions::uniform::UniformInt - Rust

[][src]Struct rand::distributions::uniform::UniformInt

pub struct UniformInt<X> { /* fields omitted */ }

The back-end implementing [UniformSampler] for integer types.

+rand::distributions::uniform::UniformInt - Rust

[][src]Struct rand::distributions::uniform::UniformInt

pub struct UniformInt<X> { /* fields omitted */ }

The back-end implementing [UniformSampler] for integer types.

Unless you are implementing [UniformSampler] for your own type, this type should not be used directly, use [Uniform] instead.

Implementation notes

-

For simplicity, we use the same generic struct UniformInt<X> for all -integer types X. This gives us only one field type, X; to store unsigned -values of this size, we take use the fact that these conversions are no-ops.

For a closed range, the number of possible numbers we should generate is -range = (high - low + 1). To avoid bias, we must ensure that the size of -our sample space, zone, is a multiple of range; other values must be -rejected (by replacing with a new random sample).

-

As a special case, we use range = 0 to represent the full range of the -result type (i.e. for new_inclusive($ty::MIN, $ty::MAX)).

-

The optimum zone is the largest product of range which fits in our -(unsigned) target type. We calculate this by calculating how many numbers we -must reject: reject = (MAX + 1) % range = (MAX - range + 1) % range. Any (large) -product of range will suffice, thus in sample_single we multiply by a -power of 2 via bit-shifting (faster but may cause more rejections).

-

The smallest integer PRNGs generate is u32. For 8- and 16-bit outputs we -use u32 for our zone and samples (because it's not slower and because -it reduces the chance of having to reject a sample). In this case we cannot -store zone in the target type since it is too large, however we know -ints_to_reject < range <= $unsigned::MAX.

+range = (high - low + 1). It is not possible to end up with a uniform +distribution if we map all the random integers that can be generated to +this range. We have to map integers from a zone that is a multiple of the +range. The rest of the integers, that cause a bias, are rejected.

+

The problem with range is that to cover the full range of the type, it has +to store unsigned_max + 1, which can't be represented. But if the range +covers the full range of the type, no modulus is needed. A range of size 0 +can't exist, so we use that to represent this special case. Wrapping +arithmetic even makes representing unsigned_max + 1 as 0 simple.

+

We don't calculate zone directly, but first calculate the number of +integers to reject. To handle unsigned_max + 1 not fitting in the type, +we use: +ints_to_reject = (unsigned_max + 1) % range; +ints_to_reject = (unsigned_max - range + 1) % range;

+

The smallest integer PRNGs generate is u32. That is why for small integer +sizes (i8/u8 and i16/u16) there is an optimization: don't pick the +largest zone that can fit in the small type, but pick the largest zone that +can fit in an u32. ints_to_reject is always less than half the size of +the small integer. This means the first bit of zone is always 1, and so +are all the other preceding bits of a larger integer. The easiest way to +grow the zone for the larger type is to simply sign extend it.

An alternative to using a modulus is widening multiply: After a widening multiply by range, the result is in the high word. Then comparing the low word against zone makes sure our distribution is uniform.

-

Trait Implementations

impl<X: Clone> Clone for UniformInt<X>[src]

Trait Implementations

impl<X: Clone> Clone for UniformInt<X>[src]

impl<X: Copy> Copy for UniformInt<X>[src]

impl<X: Debug> Debug for UniformInt<X>[src]

impl UniformSampler for UniformInt<i8>[src]

type X = i8

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<i16>[src]

type X = i16

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<usize>[src]

type X = usize

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<u128>[src]

type X = u128

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<i32>[src]

type X = i32

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<i64>[src]

type X = i64

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<i128>[src]

type X = i128

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<isize>[src]

type X = isize

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<u8>[src]

type X = u8

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<u16>[src]

type X = u16

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<u32>[src]

type X = u32

The type sampled by this implementation.

-

impl UniformSampler for UniformInt<u64>[src]

type X = u64

The type sampled by this implementation.

-

impl<X: Copy> Copy for UniformInt<X>[src]

impl<X: Debug> Debug for UniformInt<X>[src]

impl UniformSampler for UniformInt<i8>[src]

type X = i8

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<i16>[src]

type X = i16

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<usize>[src]

type X = usize

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<u128>[src]

type X = u128

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<i32>[src]

type X = i32

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<i64>[src]

type X = i64

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<i128>[src]

type X = i128

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<isize>[src]

type X = isize

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<u8>[src]

type X = u8

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<u16>[src]

type X = u16

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<u32>[src]

type X = u32

The type sampled by this implementation.

+

impl UniformSampler for UniformInt<u64>[src]

type X = u64

The type sampled by this implementation.

+

Auto Trait Implementations

impl<X> RefUnwindSafe for UniformInt<X> where
    X: RefUnwindSafe

impl<X> Send for UniformInt<X> where
    X: Send

impl<X> Sync for UniformInt<X> where
    X: Sync

impl<X> Unpin for UniformInt<X> where
    X: Unpin

impl<X> UnwindSafe for UniformInt<X> where
    X: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/distributions/uniform/trait.SampleBorrow.html b/rand/distributions/uniform/trait.SampleBorrow.html index 4c28adf..f5b3873 100644 --- a/rand/distributions/uniform/trait.SampleBorrow.html +++ b/rand/distributions/uniform/trait.SampleBorrow.html @@ -1,4 +1,4 @@ -rand::distributions::uniform::SampleBorrow - Rust

[][src]Trait rand::distributions::uniform::SampleBorrow

pub trait SampleBorrow<Borrowed> {
+rand::distributions::uniform::SampleBorrow - Rust

[][src]Trait rand::distributions::uniform::SampleBorrow

pub trait SampleBorrow<Borrowed> {
     fn borrow(&self) -> &Borrowed;
 }

Helper trait similar to Borrow but implemented only for SampleUniform and references to SampleUniform in @@ -6,5 +6,5 @@ order to resolve ambiguity issues.

Required methods

fn borrow(&self) -> &Borrowed

Immutably borrows from an owned value. See Borrow::borrow

Loading content... -

Implementations on Foreign Types

impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed where
    Borrowed: SampleUniform
[src]

Loading content... -

Implementors

impl<Borrowed> SampleBorrow<Borrowed> for Borrowed where
    Borrowed: SampleUniform
[src]

Loading content...
\ No newline at end of file +

Implementations on Foreign Types

impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed where
    Borrowed: SampleUniform
[src]

Loading content... +

Implementors

impl<Borrowed> SampleBorrow<Borrowed> for Borrowed where
    Borrowed: SampleUniform
[src]

Loading content...
\ No newline at end of file diff --git a/rand/distributions/uniform/trait.SampleUniform.html b/rand/distributions/uniform/trait.SampleUniform.html index 5bd9c5b..a7ae12e 100644 --- a/rand/distributions/uniform/trait.SampleUniform.html +++ b/rand/distributions/uniform/trait.SampleUniform.html @@ -1,4 +1,4 @@ -rand::distributions::uniform::SampleUniform - Rust

[][src]Trait rand::distributions::uniform::SampleUniform

pub trait SampleUniform: Sized {
+rand::distributions::uniform::SampleUniform - Rust

[][src]Trait rand::distributions::uniform::SampleUniform

pub trait SampleUniform: Sized {
     type Sampler: UniformSampler<X = Self>;
 }

Helper trait for creating objects using the correct implementation of [UniformSampler] for the sampling type.

@@ -7,5 +7,5 @@ sampling for a custom type.

Associated Types

type Sampler: UniformSampler<X = Self>

The UniformSampler implementation supporting type X.

Loading content... -

Implementations on Foreign Types

impl SampleUniform for i8[src]

impl SampleUniform for i16[src]

impl SampleUniform for i32[src]

impl SampleUniform for i64[src]

impl SampleUniform for i128[src]

impl SampleUniform for isize[src]

impl SampleUniform for u8[src]

impl SampleUniform for u16[src]

impl SampleUniform for u32[src]

impl SampleUniform for u64[src]

impl SampleUniform for usize[src]

impl SampleUniform for u128[src]

impl SampleUniform for f32[src]

impl SampleUniform for f64[src]

impl SampleUniform for Duration[src]

Loading content... +

Implementations on Foreign Types

impl SampleUniform for i8[src]

impl SampleUniform for i16[src]

impl SampleUniform for i32[src]

impl SampleUniform for i64[src]

impl SampleUniform for i128[src]

impl SampleUniform for isize[src]

impl SampleUniform for u8[src]

impl SampleUniform for u16[src]

impl SampleUniform for u32[src]

impl SampleUniform for u64[src]

impl SampleUniform for usize[src]

impl SampleUniform for u128[src]

impl SampleUniform for f32[src]

impl SampleUniform for f64[src]

impl SampleUniform for Duration[src]

Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/rand/distributions/uniform/trait.UniformSampler.html b/rand/distributions/uniform/trait.UniformSampler.html index c9bf80d..592a211 100644 --- a/rand/distributions/uniform/trait.UniformSampler.html +++ b/rand/distributions/uniform/trait.UniformSampler.html @@ -1,4 +1,4 @@ -rand::distributions::uniform::UniformSampler - Rust

[][src]Trait rand::distributions::uniform::UniformSampler

pub trait UniformSampler: Sized {
+rand::distributions::uniform::UniformSampler - Rust

[][src]Trait rand::distributions::uniform::UniformSampler

pub trait UniformSampler: Sized {
     type X;
     fn new<B1, B2>(low: B1, high: B2) -> Self
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
;
fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
; @@ -26,19 +26,12 @@ calling this.

Loading content...

Provided methods

fn sample_single<R: Rng + ?Sized, B1, B2>(
    low: B1,
    high: B2,
    rng: &mut R
) -> Self::X where
    B1: SampleBorrow<Self::X> + Sized,
    B2: SampleBorrow<Self::X> + Sized

Sample a single value uniformly from a range with inclusive lower bound and exclusive upper bound [low, high).

-

By default this is implemented using -UniformSampler::new(low, high).sample(rng). However, for some types -more optimal implementations for single usage may be provided via this -method (which is the case for integers and floats). -Results may not be identical.

-

Note that to use this method in a generic context, the type needs to be -retrieved via SampleUniform::Sampler as follows:

- -
-use rand::{thread_rng, distributions::uniform::{SampleUniform, UniformSampler}};
-fn sample_from_range<T: SampleUniform>(lb: T, ub: T) -> T {
-    let mut rng = thread_rng();
-    <T as SampleUniform>::Sampler::sample_single(lb, ub, &mut rng)
-}
+

Usually users should not call this directly but instead use +Uniform::sample_single, which asserts that low < high before calling +this.

+

Via this method, implementations can provide a method optimized for +sampling only a single value from the specified range. The default +implementation simply calls UniformSampler::new then sample on the +result.

Loading content... -

Implementors

impl UniformSampler for UniformDuration[src]

type X = Duration

impl UniformSampler for UniformFloat<f32>[src]

type X = f32

impl UniformSampler for UniformFloat<f64>[src]

type X = f64

impl UniformSampler for UniformInt<i128>[src]

type X = i128

impl UniformSampler for UniformInt<i16>[src]

type X = i16

impl UniformSampler for UniformInt<i32>[src]

type X = i32

impl UniformSampler for UniformInt<i64>[src]

type X = i64

impl UniformSampler for UniformInt<i8>[src]

type X = i8

impl UniformSampler for UniformInt<isize>[src]

type X = isize

impl UniformSampler for UniformInt<u128>[src]

type X = u128

impl UniformSampler for UniformInt<u16>[src]

type X = u16

impl UniformSampler for UniformInt<u32>[src]

type X = u32

impl UniformSampler for UniformInt<u64>[src]

type X = u64

impl UniformSampler for UniformInt<u8>[src]

type X = u8

impl UniformSampler for UniformInt<usize>[src]

type X = usize

Loading content...
\ No newline at end of file +

Implementors

impl UniformSampler for UniformDuration[src]

type X = Duration

impl UniformSampler for UniformFloat<f32>[src]

type X = f32

impl UniformSampler for UniformFloat<f64>[src]

type X = f64

impl UniformSampler for UniformInt<i128>[src]

type X = i128

impl UniformSampler for UniformInt<i16>[src]

type X = i16

impl UniformSampler for UniformInt<i32>[src]

type X = i32

impl UniformSampler for UniformInt<i64>[src]

type X = i64

impl UniformSampler for UniformInt<i8>[src]

type X = i8

impl UniformSampler for UniformInt<isize>[src]

type X = isize

impl UniformSampler for UniformInt<u128>[src]

type X = u128

impl UniformSampler for UniformInt<u16>[src]

type X = u16

impl UniformSampler for UniformInt<u32>[src]

type X = u32

impl UniformSampler for UniformInt<u64>[src]

type X = u64

impl UniformSampler for UniformInt<u8>[src]

type X = u8

impl UniformSampler for UniformInt<usize>[src]

type X = usize

Loading content...
\ No newline at end of file diff --git a/rand/distributions/weighted/enum.WeightedError.html b/rand/distributions/weighted/enum.WeightedError.html index 0024ee1..b8d8ab7 100644 --- a/rand/distributions/weighted/enum.WeightedError.html +++ b/rand/distributions/weighted/enum.WeightedError.html @@ -1,40 +1,10 @@ -rand::distributions::weighted::WeightedError - Rust

[][src]Enum rand::distributions::weighted::WeightedError

pub enum WeightedError {
-    NoItem,
-    InvalidWeight,
-    AllWeightsZero,
-    TooMany,
-}

Error type returned from WeightedIndex::new.

-

- Variants

-
NoItem

The provided weight collection contains no items.

-
InvalidWeight

A weight is either less than zero, greater than the supported maximum or -otherwise invalid.

-
AllWeightsZero

All items in the provided weight collection are zero.

-
TooMany

Too many weights are provided (length greater than u32::MAX)

-

Trait Implementations

impl Clone for WeightedError[src]

impl Copy for WeightedError[src]

impl Debug for WeightedError[src]

impl Display for WeightedError[src]

impl Eq for WeightedError[src]

impl Error for WeightedError[src]

impl PartialEq<WeightedError> for WeightedError[src]

impl StructuralEq for WeightedError[src]

impl StructuralPartialEq for WeightedError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + + + + + + +

Redirecting to ../../../rand/distributions/enum.WeightedError.html...

+ + + \ No newline at end of file diff --git a/rand/distributions/weighted/struct.WeightedIndex.html b/rand/distributions/weighted/struct.WeightedIndex.html index 8d13076..d119341 100644 --- a/rand/distributions/weighted/struct.WeightedIndex.html +++ b/rand/distributions/weighted/struct.WeightedIndex.html @@ -1,72 +1,10 @@ -rand::distributions::weighted::WeightedIndex - Rust

[][src]Struct rand::distributions::weighted::WeightedIndex

pub struct WeightedIndex<X: SampleUniform + PartialOrd> { /* fields omitted */ }

A distribution using weighted sampling to pick a discretely selected -item.

-

Sampling a WeightedIndex distribution returns the index of a randomly -selected element from the iterator used when the WeightedIndex was -created. The chance of a given element being picked is proportional to the -value of the element. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Performance

-

A WeightedIndex<X> contains a Vec<X> and a Uniform<X> and so its -size is the sum of the size of those objects, possibly plus some alignment.

-

Creating a WeightedIndex<X> will allocate enough space to hold N - 1 -weights of type X, where N is the number of weights. However, since -Vec doesn't guarantee a particular growth strategy, additional memory -might be allocated but not used. Since the WeightedIndex object also -contains, this might cause additional allocations, though for primitive -types, ['Uniform`] doesn't allocate any memory.

-

Time complexity of sampling from WeightedIndex is O(log N) where -N is the number of weights.

-

Sampling from WeightedIndex will result in a single call to -Uniform<X>::sample (method of the [Distribution] trait), which typically -will request a single value from the underlying RngCore, though the -exact number depends on the implementaiton of Uniform<X>::sample.

-

Example

-
-use rand::prelude::*;
-use rand::distributions::WeightedIndex;
-
-let choices = ['a', 'b', 'c'];
-let weights = [2,   1,   1];
-let dist = WeightedIndex::new(&weights).unwrap();
-let mut rng = thread_rng();
-for _ in 0..100 {
-    // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c'
-    println!("{}", choices[dist.sample(&mut rng)]);
-}
-
-let items = [('a', 0), ('b', 3), ('c', 7)];
-let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap();
-for _ in 0..100 {
-    // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c'
-    println!("{}", items[dist2.sample(&mut rng)].0);
-}
-

Methods

impl<X: SampleUniform + PartialOrd> WeightedIndex<X>[src]

pub fn new<I>(weights: I) -> Result<WeightedIndex<X>, WeightedError> where
    I: IntoIterator,
    I::Item: SampleBorrow<X>,
    X: for<'a> AddAssign<&'a X> + Clone + Default
[src]

Creates a new a WeightedIndex [Distribution] using the values -in weights. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Returns an error if the iterator is empty, if any weight is < 0, or -if its total value is 0.

-

pub fn update_weights(
    &mut self,
    new_weights: &[(usize, &X)]
) -> Result<(), WeightedError> where
    X: for<'a> AddAssign<&'a X> + for<'a> SubAssign<&'a X> + Clone + Default
[src]

Update a subset of weights, without changing the number of weights.

-

new_weights must be sorted by the index.

-

Using this method instead of new might be more efficient if only a small number of -weights is modified. No allocations are performed, unless the weight type X uses -allocation internally.

-

In case of error, self is not modified.

-

Trait Implementations

impl<X: Clone + SampleUniform + PartialOrd> Clone for WeightedIndex<X> where
    X::Sampler: Clone
[src]

impl<X: Debug + SampleUniform + PartialOrd> Debug for WeightedIndex<X> where
    X::Sampler: Debug
[src]

impl<X> Distribution<usize> for WeightedIndex<X> where
    X: SampleUniform + PartialOrd
[src]

Auto Trait Implementations

impl<X> RefUnwindSafe for WeightedIndex<X> where
    X: RefUnwindSafe,
    <X as SampleUniform>::Sampler: RefUnwindSafe

impl<X> Send for WeightedIndex<X> where
    X: Send,
    <X as SampleUniform>::Sampler: Send

impl<X> Sync for WeightedIndex<X> where
    X: Sync,
    <X as SampleUniform>::Sampler: Sync

impl<X> Unpin for WeightedIndex<X> where
    X: Unpin,
    <X as SampleUniform>::Sampler: Unpin

impl<X> UnwindSafe for WeightedIndex<X> where
    X: UnwindSafe,
    <X as SampleUniform>::Sampler: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

-

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

-

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

-

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + + + + + + +

Redirecting to ../../../rand/distributions/struct.WeightedIndex.html...

+ + + \ No newline at end of file diff --git a/rand/fn.random.html b/rand/fn.random.html index 44143fe..c6b70ac 100644 --- a/rand/fn.random.html +++ b/rand/fn.random.html @@ -1,4 +1,4 @@ -rand::random - Rust

[][src]Function rand::random

pub fn random<T>() -> T where
    Standard: Distribution<T>, 

Generates a random value using the thread-local random number generator.

+rand::random - Rust

[][src]Function rand::random

pub fn random<T>() -> T where
    Standard: Distribution<T>, 

Generates a random value using the thread-local random number generator.

This is simply a shortcut for thread_rng().gen(). See [thread_rng] for documentation of the entropy source and Standard for documentation of distributions and type-specific generation.

diff --git a/rand/fn.thread_rng.html b/rand/fn.thread_rng.html index 8aad0d2..6882e22 100644 --- a/rand/fn.thread_rng.html +++ b/rand/fn.thread_rng.html @@ -1,7 +1,7 @@ -rand::thread_rng - Rust

[][src]Function rand::thread_rng

pub fn thread_rng() -> ThreadRng

Retrieve the lazily-initialized thread-local random number generator, +rand::thread_rng - Rust

[][src]Function rand::thread_rng

pub fn thread_rng() -> ThreadRng

Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. thread_rng().gen::<i32>(), or cached locally, e.g. let mut rng = thread_rng();. Invoked by the Default trait, making -ThreadRng::default() equivalent.

+ThreadRng::default() equivelent.

For more information see [ThreadRng].

\ No newline at end of file diff --git a/rand/index.html b/rand/index.html index b9a9337..00c17f1 100644 --- a/rand/index.html +++ b/rand/index.html @@ -1,4 +1,4 @@ -rand - Rust

[][src]Crate rand

Utilities for random number generation

+rand - Rust

[][src]Crate rand

Utilities for random number generation

Rand provides utilities to generate random numbers, to convert them to useful types and distributions, and some randomness-related algorithms.

Quick Start

@@ -25,16 +25,22 @@ functionality on top of RNGs.

For the user guide and futher documentation, please read The Rust Rand Book.

Modules

-
distributions

Generating random samples from probability distributions

+
distributions

Generating random samples from probability distributions.

prelude

Convenience re-export of common members

-
rngs

Random number generators and adapters

-
seq

Sequence-related functionality

+
prngDeprecated

Pseudo-random number generators.

+
rngs

Random number generators and adapters for common usage:

+
seq

Functions for randomly accessing and sampling sequences.

Structs

Error

Error type of random number generators

+

Enums

+
ErrorKind

Error kind which can be matched over.

Traits

AsByteSliceMut

Trait for casting types to byte slices

CryptoRng

A marker trait used to indicate that an [RngCore] or BlockRngCore implementation is supposed to be cryptographically secure.

+
FromEntropy

A convenience extension to [SeedableRng] allowing construction from fresh +entropy. This trait is automatically implemented for any PRNG implementing +[SeedableRng] and is not intended to be implemented by users.

Rng

An automatically-implemented extension trait on [RngCore] providing high-level generic methods for sampling values and other convenience methods.

RngCore

The core of a random number generator.

@@ -45,5 +51,5 @@ generic methods for sampling values and other convenience methods.

seeded by the system. Intended to be used in method chaining style, e.g. thread_rng().gen::<i32>(), or cached locally, e.g. let mut rng = thread_rng();. Invoked by the Default trait, making -ThreadRng::default() equivalent.

+ThreadRng::default() equivelent.

\ No newline at end of file diff --git a/rand/prelude/index.html b/rand/prelude/index.html index 0217cfc..6b335ca 100644 --- a/rand/prelude/index.html +++ b/rand/prelude/index.html @@ -1,4 +1,4 @@ -rand::prelude - Rust

[][src]Module rand::prelude

Convenience re-export of common members

+rand::prelude - Rust

[][src]Module rand::prelude

Convenience re-export of common members

Like the standard library's prelude, this module simplifies importing of common items. Unlike the standard prelude, the contents of this module must be imported manually:

@@ -6,4 +6,4 @@ be imported manually:

 use rand::prelude::*;

Re-exports

-
pub use crate::distributions::Distribution;
pub use crate::rngs::StdRng;
pub use crate::rngs::ThreadRng;
pub use crate::seq::IteratorRandom;
pub use crate::seq::SliceRandom;
pub use crate::random;
pub use crate::thread_rng;
pub use crate::CryptoRng;
pub use crate::Rng;
pub use crate::RngCore;
pub use crate::SeedableRng;
\ No newline at end of file +
pub use distributions::Distribution;
pub use rngs::SmallRng;
pub use rngs::StdRng;
pub use rngs::ThreadRng;
pub use Rng;
pub use RngCore;
pub use CryptoRng;
pub use SeedableRng;
pub use FromEntropy;
pub use random;
pub use thread_rng;
pub use seq::SliceRandom;
pub use seq::IteratorRandom;
\ No newline at end of file diff --git a/rand/rngs/adapter/index.html b/rand/rngs/adapter/index.html index f2bd81d..b8ced92 100644 --- a/rand/rngs/adapter/index.html +++ b/rand/rngs/adapter/index.html @@ -1,7 +1,6 @@ rand::rngs::adapter - Rust

[][src]Module rand::rngs::adapter

Wrappers / adapters forming RNGs

Structs

-
ReadError

ReadRng error type

-
ReadRng

An RNG that reads random bytes straight from any type supporting +
ReadRng

An RNG that reads random bytes straight from any type supporting [std::io::Read], for example files.

ReseedingRng

A wrapper around any PRNG that implements BlockRngCore, that adds the ability to reseed it.

diff --git a/rand/rngs/adapter/sidebar-items.js b/rand/rngs/adapter/sidebar-items.js index 9158072..4d01d9a 100644 --- a/rand/rngs/adapter/sidebar-items.js +++ b/rand/rngs/adapter/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["ReadError","`ReadRng` error type"],["ReadRng","An RNG that reads random bytes straight from any type supporting [`std::io::Read`], for example files."],["ReseedingRng","A wrapper around any PRNG that implements [`BlockRngCore`], that adds the ability to reseed it."]]}); \ No newline at end of file +initSidebarItems({"struct":[["ReadRng","An RNG that reads random bytes straight from any type supporting [`std::io::Read`], for example files."],["ReseedingRng","A wrapper around any PRNG that implements [`BlockRngCore`], that adds the ability to reseed it."]]}); \ No newline at end of file diff --git a/rand/rngs/adapter/struct.ReadRng.html b/rand/rngs/adapter/struct.ReadRng.html index 881d0cb..4bb1d8d 100644 --- a/rand/rngs/adapter/struct.ReadRng.html +++ b/rand/rngs/adapter/struct.ReadRng.html @@ -1,8 +1,8 @@ -rand::rngs::adapter::ReadRng - Rust

[][src]Struct rand::rngs::adapter::ReadRng

pub struct ReadRng<R> { /* fields omitted */ }

An RNG that reads random bytes straight from any type supporting +rand::rngs::adapter::ReadRng - Rust

[][src]Struct rand::rngs::adapter::ReadRng

pub struct ReadRng<R> { /* fields omitted */ }

An RNG that reads random bytes straight from any type supporting [std::io::Read], for example files.

This will work best with an infinite reader, but that is not required.

This can be used with /dev/urandom on Unix but it is recommended to use -OsRng instead.

+OsRng instead.

Panics

ReadRng uses [std::io::Read::read_exact], which retries on interrupts. All other errors from the underlying reader, including when it does not @@ -16,27 +16,33 @@ The other [RngCore] methods will panic in case of an error.

let data = vec![1, 2, 3, 4, 5, 6, 7, 8]; let mut rng = ReadRng::new(&data[..]); println!("{:x}", rng.gen::<u32>());
-

Methods

impl<R: Read> ReadRng<R>[src]

pub fn new(r: R) -> ReadRng<R>[src]

Create a new ReadRng from a Read.

-

Trait Implementations

impl<R: Debug> Debug for ReadRng<R>[src]

impl<R: Read> RngCore for ReadRng<R>[src]

Methods

impl<R: Read> ReadRng<R>[src]

pub fn new(r: R) -> ReadRng<R>[src]

Create a new ReadRng from a Read.

+

Trait Implementations

impl<R: Debug> Debug for ReadRng<R>[src]

impl<R: Read> RngCore for ReadRng<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for ReadRng<R> where
    R: RefUnwindSafe

impl<R> Send for ReadRng<R> where
    R: Send

impl<R> Sync for ReadRng<R> where
    R: Sync

impl<R> Unpin for ReadRng<R> where
    R: Unpin

impl<R> UnwindSafe for ReadRng<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file + \ No newline at end of file diff --git a/rand/rngs/adapter/struct.ReseedingRng.html b/rand/rngs/adapter/struct.ReseedingRng.html index 26091d2..f8ecc96 100644 --- a/rand/rngs/adapter/struct.ReseedingRng.html +++ b/rand/rngs/adapter/struct.ReseedingRng.html @@ -1,4 +1,4 @@ -rand::rngs::adapter::ReseedingRng - Rust

[][src]Struct rand::rngs::adapter::ReseedingRng

pub struct ReseedingRng<R, Rsdr>(_)
where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
;

A wrapper around any PRNG that implements BlockRngCore, that adds the +rand::rngs::adapter::ReseedingRng - Rust

[][src]Struct rand::rngs::adapter::ReseedingRng

pub struct ReseedingRng<R, Rsdr>(_)
where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
;

A wrapper around any PRNG that implements BlockRngCore, that adds the ability to reseed it.

ReseedingRng reseeds the underlying PRNG in the following cases:

    @@ -6,7 +6,7 @@ ability to reseed it.

  • After clone(), the clone will be reseeded on first use.
  • After a process is forked, the RNG in the child process is reseeded within the next few generated values, depending on the block size of the -underlying PRNG. For ChaCha and Hc128 this is a maximum of +underlying PRNG. For ChaChaCore and Hc128Core this is a maximum of 15 u32 values before reseeding.
  • After the PRNG has generated a configurable number of random bytes.
@@ -32,44 +32,51 @@ reports the error.

Example

 use rand::prelude::*;
-use rand_chacha::ChaCha20Core; // Internal part of ChaChaRng that
+use rand_chacha::ChaChaCore; // Internal part of ChaChaRng that
                              // implements BlockRngCore
 use rand::rngs::OsRng;
 use rand::rngs::adapter::ReseedingRng;
 
-let prng = ChaCha20Core::from_entropy();
-let mut reseeding_rng = ReseedingRng::new(prng, 0, OsRng);
+let prng = ChaChaCore::from_entropy();
+let reseeder = OsRng::new().unwrap();
+let mut reseeding_rng = ReseedingRng::new(prng, 0, reseeder);
 
 println!("{}", reseeding_rng.gen::<u64>());
 
 let mut cloned_rng = reseeding_rng.clone();
 assert!(reseeding_rng.gen::<u64>() != cloned_rng.gen::<u64>());
-

Methods

impl<R, Rsdr> ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
[src]

pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self[src]

Create a new ReseedingRng from an existing PRNG, combined with a RNG +

Methods

impl<R, Rsdr> ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
[src]

pub fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self[src]

Create a new ReseedingRng from an existing PRNG, combined with a RNG to use as reseeder.

threshold sets the number of generated bytes after which to reseed the PRNG. Set it to zero to never reseed based on the number of generated values.

-

pub fn reseed(&mut self) -> Result<(), Error>[src]

Reseed the internal PRNG.

-

Trait Implementations

impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + Clone,
    Rsdr: RngCore + Clone
[src]

pub fn reseed(&mut self) -> Result<(), Error>[src]

Reseed the internal PRNG.

+

Trait Implementations

impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + Clone,
    Rsdr: RngCore + Clone
[src]

impl<R, Rsdr> CryptoRng for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + CryptoRng,
    Rsdr: RngCore + CryptoRng
[src]

impl<R: Debug, Rsdr: Debug> Debug for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
[src]

impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

impl<R, Rsdr> CryptoRng for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + CryptoRng,
    Rsdr: RngCore + CryptoRng
[src]

impl<R: Debug, Rsdr: Debug> Debug for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
[src]

impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

Auto Trait Implementations

impl<R, Rsdr> RefUnwindSafe for ReseedingRng<R, Rsdr> where
    R: RefUnwindSafe,
    Rsdr: RefUnwindSafe,
    <R as BlockRngCore>::Results: RefUnwindSafe

impl<R, Rsdr> Send for ReseedingRng<R, Rsdr> where
    R: Send,
    Rsdr: Send,
    <R as BlockRngCore>::Results: Send

impl<R, Rsdr> Sync for ReseedingRng<R, Rsdr> where
    R: Sync,
    Rsdr: Sync,
    <R as BlockRngCore>::Results: Sync

impl<R, Rsdr> Unpin for ReseedingRng<R, Rsdr> where
    R: Unpin,
    Rsdr: Unpin,
    <R as BlockRngCore>::Results: Unpin

impl<R, Rsdr> UnwindSafe for ReseedingRng<R, Rsdr> where
    R: UnwindSafe,
    Rsdr: UnwindSafe,
    <R as BlockRngCore>::Results: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/rngs/index.html b/rand/rngs/index.html index 21920c9..ef02d1b 100644 --- a/rand/rngs/index.html +++ b/rand/rngs/index.html @@ -1,82 +1,125 @@ -rand::rngs - Rust

[][src]Module rand::rngs

Random number generators and adapters

-

Background: Random number generators (RNGs)

-

Computers cannot produce random numbers from nowhere. We classify -random number generators as follows:

+rand::rngs - Rust

[][src]Module rand::rngs

Random number generators and adapters for common usage:

    -
  • "True" random number generators (TRNGs) use hard-to-predict data sources -(e.g. the high-resolution parts of event timings and sensor jitter) to -harvest random bit-sequences, apply algorithms to remove bias and -estimate available entropy, then combine these bits into a byte-sequence -or an entropy pool. This job is usually done by the operating system or -a hardware generator (HRNG).
  • -
  • "Pseudo"-random number generators (PRNGs) use algorithms to transform a -seed into a sequence of pseudo-random numbers. These generators can be -fast and produce well-distributed unpredictable random numbers (or not). -They are usually deterministic: given algorithm and seed, the output -sequence can be reproduced. They have finite period and eventually loop; -with many algorithms this period is fixed and can be proven sufficiently -long, while others are chaotic and the period depends on the seed.
  • -
  • "Cryptographically secure" pseudo-random number generators (CSPRNGs) -are the sub-set of PRNGs which are secure. Security of the generator -relies both on hiding the internal state and using a strong algorithm.
  • +
  • ThreadRng, a fast, secure, auto-seeded thread-local generator
  • +
  • StdRng and SmallRng, algorithms to cover typical usage
  • +
  • EntropyRng, OsRng and JitterRng as entropy sources
  • +
  • mock::StepRng as a simple counter for tests
  • +
  • adapter::ReadRng to read from a file/stream
  • +
  • adapter::ReseedingRng to reseed a PRNG on clone / process fork etc.
-

Traits and functionality

-

All RNGs implement the RngCore trait, as a consequence of which the -Rng extension trait is automatically implemented. Secure RNGs may -additionally implement the CryptoRng trait.

-

All PRNGs require a seed to produce their random number sequence. The -SeedableRng trait provides three ways of constructing PRNGs:

+

Background — Random number generators (RNGs)

+

Computers are inherently deterministic, so to get random numbers one +either has to use a hardware generator or collect bits of entropy from +various sources (e.g. event timestamps, or jitter). This is a relatively +slow and complicated operation.

+

Generally the operating system will collect some entropy, remove bias, and +use that to seed its own PRNG; OsRng provides an interface to this. +JitterRng is an entropy collector included with Rand that measures +jitter in the CPU execution time, and jitter in memory access time. +EntropyRng is a wrapper that uses the best entropy source that is +available.

+

Pseudo-random number generators

+

What is commonly used instead of "true" random number renerators, are +pseudo-random number generators (PRNGs), deterministic algorithms that +produce an infinite stream of pseudo-random numbers from a small random +seed. PRNGs are faster, and have better provable properties. The numbers +produced can be statistically of very high quality and can be impossible to +predict. (They can also have obvious correlations and be trivial to predict; +quality varies.)

+

There are two different types of PRNGs: those developed for simulations +and statistics, and those developed for use in cryptography; the latter are +called Cryptographically Secure PRNGs (CSPRNG or CPRNG). Both types can +have good statistical quality but the latter also have to be impossible to +predict, even after seeing many previous output values. Rand provides a good +default algorithm from each class:

    -
  • from_seed accepts a type specific to the PRNG
  • -
  • from_rng allows a PRNG to be seeded from any other RNG
  • -
  • seed_from_u64 allows any PRNG to be seeded from a u64 insecurely
  • -
  • from_entropy securely seeds a PRNG from fresh entropy
  • +
  • SmallRng is a PRNG chosen for low memory usage, high performance and +good statistical quality.
  • +
  • StdRng is a CSPRNG chosen for good performance and trust of security +(based on reviews, maturity and usage). The current algorithm is HC-128, +which is one of the recommendations by ECRYPT's eSTREAM project.
-

Use the [rand_core] crate when implementing your own RNGs.

-

Our generators

-

This crate provides several random number generators:

+

The above PRNGs do not cover all use-cases; more algorithms can be found in +the [prng][crate::prng] module, as well as in several other crates. For example, you +may wish a CSPRNG with significantly lower memory usage than StdRng +while being less concerned about performance, in which case ChaChaRng +is a good choice.

+

One complexity is that the internal state of a PRNG must change with every +generated number. For APIs this generally means a mutable reference to the +state of the PRNG has to be passed around.

+

A solution is ThreadRng. This is a thread-local implementation of +StdRng with automatic seeding on first use. It is the best choice if you +"just" want a convenient, secure, fast random number source. Use via the +[thread_rng] function, which gets a reference to the current thread's +local instance.

+

Seeding

+

As mentioned above, PRNGs require a random seed in order to produce random +output. This is especially important for CSPRNGs, which are still +deterministic algorithms, thus can only be secure if their seed value is +also secure. To seed a PRNG, use one of:

    -
  • [OsRng] is an interface to the operating system's random number -source. Typically the operating system uses a CSPRNG with entropy -provided by a TRNG and some type of on-going re-seeding.
  • -
  • [ThreadRng], provided by the thread_rng function, is a handle to a -thread-local CSPRNG with periodic seeding from [OsRng]. Because this -is local, it is typically much faster than [OsRng]. It should be -secure, though the paranoid may prefer [OsRng].
  • -
  • [StdRng] is a CSPRNG chosen for good performance and trust of security -(based on reviews, maturity and usage). The current algorithm is ChaCha20, -which is well established and rigorously analysed. -[StdRng] provides the algorithm used by [ThreadRng] but without -periodic reseeding.
  • -
  • [SmallRng] is an insecure PRNG designed to be fast, simple, require -little memory, and have good output quality.
  • +
  • [FromEntropy::from_entropy]; this is the most convenient way to seed +with fresh, secure random data.
  • +
  • [SeedableRng::from_rng]; this allows seeding from another PRNG or +from an entropy source such as EntropyRng.
  • +
  • [SeedableRng::from_seed]; this is mostly useful if you wish to be able +to reproduce the output sequence by using a fixed seed. (Don't use +StdRng or SmallRng in this case since different algorithms may be +used by future versions of Rand; use an algorithm from the +[prng] module.)
-

The algorithms selected for [StdRng] and [SmallRng] may change in any -release and may be platform-dependent, therefore they should be considered -not reproducible.

-

Additional generators

-

TRNGs: The rdrand crate provides an interface to the RDRAND and -RDSEED instructions available in modern Intel and AMD CPUs. -The rand_jitter crate provides a user-space implementation of -entropy harvesting from CPU timer jitter, but is very slow and has -security issues.

-

PRNGs: Several companion crates are available, providing individual or -families of PRNG algorithms. These provide the implementations behind -[StdRng] and [SmallRng] but can also be used directly, indeed should -be used directly when reproducibility matters. -Some suggestions are: rand_chacha, rand_pcg, rand_xoshiro. -A full list can be found by searching for crates with the rng tag.

+

Conclusion

+
    +
  • [thread_rng] is what you often want to use.
  • +
  • If you want more control, flexibility, or better performance, use +StdRng, SmallRng or an algorithm from the [prng] module.
  • +
  • Use [FromEntropy::from_entropy] to seed new PRNGs.
  • +
  • If you need reproducibility, use [SeedableRng::from_seed] combined with +a named PRNG.
  • +
+

More information and notes on cryptographic security can be found +in the [prng] module.

+

Examples

+

Examples of seeding PRNGs:

+ +
+use rand::prelude::*;
+
+// StdRng seeded securely by the OS or local entropy collector:
+let mut rng = StdRng::from_entropy();
+
+// SmallRng seeded from thread_rng:
+let mut rng = SmallRng::from_rng(thread_rng())?;
+
+// SmallRng seeded by a constant, for deterministic results:
+let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; // byte array
+let mut rng = SmallRng::from_seed(seed);
+

Implementing custom RNGs

+

If you want to implement custom RNG, see the [rand_core] crate. The RNG +will have to implement the [RngCore] trait, where the [Rng] trait is +build on top of.

+

If the RNG needs seeding, also implement the [SeedableRng] trait.

+

[CryptoRng] is a marker trait cryptographically secure PRNGs can +implement.

Modules

adapter

Wrappers / adapters forming RNGs

mock

Mock random number generator

Structs

-
EntropyRngDeprecated

An interface returning random data from external source(s), provided +
EntropyRng

An interface returning random data from external source(s), provided specifically for securely seeding algorithmic generators (PRNGs).

-
OsRng

A random number generator that retrieves randomness from from the +

JitterRng

A true random number generator based on jitter in the CPU execution time, +and jitter in memory access time.

+
OsRng

A random number generator that retrieves randomness straight from the operating system.

+
SmallRng

An RNG recommended when small state, cheap initialization and good +performance are required. The PRNG algorithm in SmallRng is chosen to be +efficient on the current platform, without consideration for cryptography +or security. The size of its state is much smaller than for StdRng.

StdRng

The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG).

ThreadRng

The type returned by [thread_rng], essentially just a reference to the PRNG in thread-local memory.

+

Enums

+
TimerError

An error that can occur when JitterRng::test_timer fails.

\ No newline at end of file diff --git a/rand/rngs/mock/index.html b/rand/rngs/mock/index.html index 599e64d..88d0533 100644 --- a/rand/rngs/mock/index.html +++ b/rand/rngs/mock/index.html @@ -1,4 +1,4 @@ -rand::rngs::mock - Rust

[][src]Module rand::rngs::mock

Mock random number generator

+rand::rngs::mock - Rust

[][src]Module rand::rngs::mock

Mock random number generator

Structs

StepRng

A simple implementation of RngCore for testing purposes.

\ No newline at end of file diff --git a/rand/rngs/mock/struct.StepRng.html b/rand/rngs/mock/struct.StepRng.html index f1c3cb7..7c4b84a 100644 --- a/rand/rngs/mock/struct.StepRng.html +++ b/rand/rngs/mock/struct.StepRng.html @@ -1,4 +1,4 @@ -rand::rngs::mock::StepRng - Rust

[][src]Struct rand::rngs::mock::StepRng

pub struct StepRng { /* fields omitted */ }

A simple implementation of RngCore for testing purposes.

+rand::rngs::mock::StepRng - Rust

[][src]Struct rand::rngs::mock::StepRng

pub struct StepRng { /* fields omitted */ }

A simple implementation of RngCore for testing purposes.

This generates an arithmetic sequence (i.e. adds a constant each step) over a u64 number, using wrapping arithmetic. If the increment is 0 the generator yields a constant.

@@ -6,32 +6,38 @@ the generator yields a constant.

 use rand::Rng;
 use rand::rngs::mock::StepRng;
-
+ 
 let mut my_rng = StepRng::new(2, 1);
 let sample: [u64; 3] = my_rng.gen();
 assert_eq!(sample, [2, 3, 4]);
-

Methods

impl StepRng[src]

pub fn new(initial: u64, increment: u64) -> Self[src]

Create a StepRng, yielding an arithmetic sequence starting with +

Methods

impl StepRng[src]

pub fn new(initial: u64, increment: u64) -> Self[src]

Create a StepRng, yielding an arithmetic sequence starting with initial and incremented by increment each time.

Trait Implementations

impl Clone for StepRng[src]

impl Debug for StepRng[src]

impl RngCore for StepRng[src]

impl RngCore for StepRng[src]

Auto Trait Implementations

impl RefUnwindSafe for StepRng

impl Send for StepRng

impl Sync for StepRng

impl Unpin for StepRng

impl UnwindSafe for StepRng

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/rngs/sidebar-items.js b/rand/rngs/sidebar-items.js index 59219a0..370445a 100644 --- a/rand/rngs/sidebar-items.js +++ b/rand/rngs/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"mod":[["adapter","Wrappers / adapters forming RNGs"],["mock","Mock random number generator"]],"struct":[["EntropyRng","An interface returning random data from external source(s), provided specifically for securely seeding algorithmic generators (PRNGs)."],["OsRng","A random number generator that retrieves randomness from from the operating system."],["StdRng","The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG)."],["ThreadRng","The type returned by [`thread_rng`], essentially just a reference to the PRNG in thread-local memory."]]}); \ No newline at end of file +initSidebarItems({"enum":[["TimerError","An error that can occur when [`JitterRng::test_timer`] fails."]],"mod":[["adapter","Wrappers / adapters forming RNGs"],["mock","Mock random number generator"]],"struct":[["EntropyRng","An interface returning random data from external source(s), provided specifically for securely seeding algorithmic generators (PRNGs)."],["JitterRng","A true random number generator based on jitter in the CPU execution time, and jitter in memory access time."],["OsRng","A random number generator that retrieves randomness straight from the operating system."],["SmallRng","An RNG recommended when small state, cheap initialization and good performance are required. The PRNG algorithm in `SmallRng` is chosen to be efficient on the current platform, without consideration for cryptography or security. The size of its state is much smaller than for [`StdRng`]."],["StdRng","The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG)."],["ThreadRng","The type returned by [`thread_rng`], essentially just a reference to the PRNG in thread-local memory."]]}); \ No newline at end of file diff --git a/rand/rngs/struct.EntropyRng.html b/rand/rngs/struct.EntropyRng.html index 5d14c4a..41649f8 100644 --- a/rand/rngs/struct.EntropyRng.html +++ b/rand/rngs/struct.EntropyRng.html @@ -1,32 +1,54 @@ -rand::rngs::EntropyRng - Rust

[][src]Struct rand::rngs::EntropyRng

pub struct EntropyRng { /* fields omitted */ }
Deprecated since 0.7.0:

use rngs::OsRng instead

-

An interface returning random data from external source(s), provided +rand::rngs::EntropyRng - Rust

[][src]Struct rand::rngs::EntropyRng

pub struct EntropyRng { /* fields omitted */ }

An interface returning random data from external source(s), provided specifically for securely seeding algorithmic generators (PRNGs).

-

This is deprecated. It is suggested you use rngs::OsRng instead.

-

Methods

impl EntropyRng[src]

pub fn new() -> Self[src]

Create a new EntropyRng.

+

Where possible, EntropyRng retrieves random data from the operating +system's interface for random numbers (OsRng); if that fails it will +fall back to the JitterRng entropy collector. In the latter case it will +still try to use OsRng on the next usage.

+

If no secure source of entropy is available EntropyRng will panic on use; +i.e. it should never output predictable data.

+

This is either a little slow (OsRng requires a system call) or extremely +slow (JitterRng must use significant CPU time to generate sufficient +jitter); for better performance it is common to seed a local PRNG from +external entropy then primarily use the local PRNG (thread_rng is +provided as a convenient, local, automatically-seeded CSPRNG).

+

Panics

+

On most systems, like Windows, Linux, macOS and *BSD on common hardware, it +is highly unlikely for both OsRng and JitterRng to fail. But on +combinations like webassembly without Emscripten or stdweb both sources are +unavailable. If both sources fail, only try_fill_bytes is able to +report the error, and only the one from OsRng. The other [RngCore] +methods will panic in case of an error.

+

Methods

impl EntropyRng[src]

pub fn new() -> Self[src]

Create a new EntropyRng.

This method will do no system calls or other initialization routines, those are done on first use. This is done to make new infallible, and try_fill_bytes the only place to report errors.

-

Trait Implementations

impl CryptoRng for EntropyRng[src]

impl Debug for EntropyRng[src]

impl Default for EntropyRng[src]

impl RngCore for EntropyRng[src]

Trait Implementations

impl CryptoRng for EntropyRng[src]

impl Debug for EntropyRng[src]

impl Default for EntropyRng[src]

impl RngCore for EntropyRng[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/rngs/struct.OsRng.html b/rand/rngs/struct.OsRng.html index c5d7266..e34f78d 100644 --- a/rand/rngs/struct.OsRng.html +++ b/rand/rngs/struct.OsRng.html @@ -1,46 +1,32 @@ -rand::rngs::OsRng - Rust

[][src]Struct rand::rngs::OsRng

pub struct OsRng;

A random number generator that retrieves randomness from from the +rand::rngs::OsRng - Rust

[][src]Struct rand::rngs::OsRng

pub struct OsRng(_);

A random number generator that retrieves randomness straight from the operating system.

-

This is a zero-sized struct. It can be freely constructed with OsRng.

-

The implementation is provided by the getrandom crate. Refer to -getrandom documentation for details.

-

This struct is only available when specifying the crate feature getrandom -or std. When using the rand lib, it is also available as rand::rngs::OsRng.

-

Blocking and error handling

-

It is possible that when used during early boot the first call to OsRng -will block until the system's RNG is initialised. It is also possible -(though highly unlikely) for OsRng to fail on some platforms, most -likely due to system mis-configuration.

-

After the first successful call, it is highly unlikely that failures or -significant delays will occur (although performance should be expected to -be much slower than a user-space PRNG).

-

Usage example

-
-use rand_core::{RngCore, OsRng};
-
-let mut key = [0u8; 16];
-OsRng.fill_bytes(&mut key);
-let random_u64 = OsRng.next_u64();
-

Trait Implementations

impl Clone for OsRng[src]

Methods

impl OsRng[src]

pub fn new() -> Result<OsRng, Error>[src]

Create a new OsRng.

+

Trait Implementations

impl Clone for OsRng[src]

impl Copy for OsRng[src]

impl CryptoRng for OsRng[src]

impl Debug for OsRng[src]

impl Default for OsRng[src]

impl RngCore for OsRng[src]

impl CryptoRng for OsRng[src]

impl Debug for OsRng[src]

impl RngCore for OsRng[src]

Auto Trait Implementations

impl RefUnwindSafe for OsRng

impl Send for OsRng

impl Sync for OsRng

impl Unpin for OsRng

impl UnwindSafe for OsRng

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/rngs/struct.StdRng.html b/rand/rngs/struct.StdRng.html index f279046..f101726 100644 --- a/rand/rngs/struct.StdRng.html +++ b/rand/rngs/struct.StdRng.html @@ -1,38 +1,45 @@ -rand::rngs::StdRng - Rust

[][src]Struct rand::rngs::StdRng

pub struct StdRng(_);

The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient +rand::rngs::StdRng - Rust

[][src]Struct rand::rngs::StdRng

pub struct StdRng(_);

The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG).

-

The current algorithm used is the ChaCha block cipher with 20 rounds. -This may change as new evidence of cipher security and performance -becomes available.

-

The algorithm is deterministic but should not be considered reproducible -due to dependence on configuration and possible replacement in future -library versions. For a secure reproducible generator, we recommend use of -the rand_chacha crate directly.

-

Trait Implementations

impl Clone for StdRng[src]

Trait Implementations

impl Clone for StdRng[src]

impl CryptoRng for StdRng[src]

impl Debug for StdRng[src]

impl RngCore for StdRng[src]

impl SeedableRng for StdRng[src]

type Seed = <Rng as SeedableRng>::Seed

Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we recommend [u8; N] for some N). Read more

-

impl CryptoRng for StdRng[src]

impl Debug for StdRng[src]

impl RngCore for StdRng[src]

impl SeedableRng for StdRng[src]

type Seed = <Hc128Rng as SeedableRng>::Seed

Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we recommend [u8; N] for some N). Read more

+

Auto Trait Implementations

impl RefUnwindSafe for StdRng

impl Send for StdRng

impl Sync for StdRng

impl Unpin for StdRng

impl UnwindSafe for StdRng

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<R> FromEntropy for R where
    R: SeedableRng
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/rngs/struct.ThreadRng.html b/rand/rngs/struct.ThreadRng.html index 5e1367a..eeed3ab 100644 --- a/rand/rngs/struct.ThreadRng.html +++ b/rand/rngs/struct.ThreadRng.html @@ -1,35 +1,48 @@ -rand::rngs::ThreadRng - Rust

[][src]Struct rand::rngs::ThreadRng

pub struct ThreadRng { /* fields omitted */ }

The type returned by [thread_rng], essentially just a reference to the +rand::rngs::ThreadRng - Rust

[][src]Struct rand::rngs::ThreadRng

pub struct ThreadRng { /* fields omitted */ }

The type returned by [thread_rng], essentially just a reference to the PRNG in thread-local memory.

-

ThreadRng uses the same PRNG as StdRng for security and performance. -As hinted by the name, the generator is thread-local. ThreadRng is a -handle to this generator and thus supports Copy, but not Send or Sync.

-

Unlike StdRng, ThreadRng uses the ReseedingRng wrapper to reseed -the PRNG from fresh entropy every 64 kiB of random data. -[OsRng] is used to provide seed data.

-

Note that the reseeding is done as an extra precaution against side-channel -attacks and mis-use (e.g. if somehow weak entropy were supplied initially). -The PRNG algorithms used are assumed to be secure.

-

Trait Implementations

impl Clone for ThreadRng[src]

Trait Implementations

impl Clone for ThreadRng[src]

impl Copy for ThreadRng[src]

impl CryptoRng for ThreadRng[src]

impl Debug for ThreadRng[src]

impl Default for ThreadRng[src]

impl RngCore for ThreadRng[src]

impl CryptoRng for ThreadRng[src]

impl Debug for ThreadRng[src]

impl Default for ThreadRng[src]

impl RngCore for ThreadRng[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<R> Rng for R where
    R: RngCore + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/seq/index.html b/rand/seq/index.html index 0ff7b22..f8e04a6 100644 --- a/rand/seq/index.html +++ b/rand/seq/index.html @@ -1,24 +1,14 @@ -rand::seq - Rust

[][src]Module rand::seq

Sequence-related functionality

-

This module provides:

-
    -
  • [SliceRandom] slice sampling and mutation
  • -
  • [IteratorRandom] iterator sampling
  • -
  • [index::sample] low-level API to choose multiple indices from -0..length
  • -
-

Also see:

-
    -
  • [crate::distributions::weighted] module which provides -implementations of weighted index sampling.
  • -
-

In order to make results reproducible across 32-64 bit architectures, all -usize indices are sampled as a u32 where possible (also providing a -small performance boost in some cases).

+rand::seq - Rust

[][src]Module rand::seq

Functions for randomly accessing and sampling sequences.

+

TODO: module doc

Modules

-
index

Low-level API for sampling indices

+
index

Index sampling

Structs

-
SliceChooseIter

An iterator over multiple slice elements.

+
SliceChooseIter

Iterator over multiple choices, as returned by [`SliceRandom::choose_multiple]

Traits

IteratorRandom

Extension trait on iterators, providing random sampling methods.

SliceRandom

Extension trait on slices, providing random mutation and sampling methods.

+

Functions

+
sample_iterDeprecated

Randomly sample amount elements from a finite iterator.

+
sample_sliceDeprecated

Randomly sample exactly amount values from slice.

+
sample_slice_refDeprecated

Randomly sample exactly amount references from slice.

\ No newline at end of file diff --git a/rand/seq/index/enum.IndexVec.html b/rand/seq/index/enum.IndexVec.html index bef8f45..1a852c2 100644 --- a/rand/seq/index/enum.IndexVec.html +++ b/rand/seq/index/enum.IndexVec.html @@ -1,21 +1,20 @@ -rand::seq::index::IndexVec - Rust

[][src]Enum rand::seq::index::IndexVec

pub enum IndexVec {
+rand::seq::index::IndexVec - Rust

[][src]Enum rand::seq::index::IndexVec

pub enum IndexVec {
     // some variants omitted
 }

A vector of indices.

Multiple internal representations are possible.

-

Methods

impl IndexVec[src]

pub fn len(&self) -> usize[src]

Returns the number of indices

-

pub fn is_empty(&self) -> bool[src]

Returns true if the length is 0.

-

pub fn index(&self, index: usize) -> usize[src]

Return the value at the given index.

+

Methods

impl IndexVec[src]

pub fn len(&self) -> usize[src]

Returns the number of indices

+

pub fn index(&self, index: usize) -> usize[src]

Return the value at the given index.

(Note: we cannot implement [std::ops::Index] because of lifetime restrictions.)

-

pub fn into_vec(self) -> Vec<usize>[src]

Return result as a Vec<usize>. Conversion may or may not be trivial.

-

pub fn iter(&self) -> IndexVecIter[src]

Iterate over the indices as a sequence of usize values

-

pub fn into_iter(self) -> IndexVecIntoIter[src]

Convert into an iterator over the indices as a sequence of usize values

-

Trait Implementations

impl Clone for IndexVec[src]

pub fn into_vec(self) -> Vec<usize>[src]

Return result as a Vec<usize>. Conversion may or may not be trivial.

+

pub fn iter<'a>(&'a self) -> IndexVecIter<'a>[src]

Iterate over the indices as a sequence of usize values

+

pub fn into_iter(self) -> IndexVecIntoIter[src]

Convert into an iterator over the indices as a sequence of usize values

+

Trait Implementations

impl Clone for IndexVec[src]

impl Debug for IndexVec[src]

impl From<Vec<u32>> for IndexVec[src]

impl From<Vec<usize>> for IndexVec[src]

impl PartialEq<IndexVec> for IndexVec[src]

impl Debug for IndexVec[src]

impl From<Vec<u32>> for IndexVec[src]

impl From<Vec<usize>> for IndexVec[src]

impl PartialEq<IndexVec> for IndexVec[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/seq/index/enum.IndexVecIntoIter.html b/rand/seq/index/enum.IndexVecIntoIter.html index 73f1dbe..df9db35 100644 --- a/rand/seq/index/enum.IndexVecIntoIter.html +++ b/rand/seq/index/enum.IndexVecIntoIter.html @@ -1,14 +1,14 @@ -rand::seq::index::IndexVecIntoIter - Rust

[][src]Enum rand::seq::index::IndexVecIntoIter

pub enum IndexVecIntoIter {
+rand::seq::index::IndexVecIntoIter - Rust

[][src]Enum rand::seq::index::IndexVecIntoIter

pub enum IndexVecIntoIter {
     // some variants omitted
 }

Return type of IndexVec::into_iter.

-

Trait Implementations

impl Clone for IndexVecIntoIter[src]

Trait Implementations

impl Clone for IndexVecIntoIter[src]

impl Debug for IndexVecIntoIter[src]

impl ExactSizeIterator for IndexVecIntoIter[src]

impl Debug for IndexVecIntoIter[src]

impl ExactSizeIterator for IndexVecIntoIter[src]

impl Iterator for IndexVecIntoIter[src]

type Item = usize

The type of the elements being iterated over.

-

impl Iterator for IndexVecIntoIter[src]

type Item = usize

The type of the elements being iterated over.

+

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/seq/index/enum.IndexVecIter.html b/rand/seq/index/enum.IndexVecIter.html index a01df69..eca7f2a 100644 --- a/rand/seq/index/enum.IndexVecIter.html +++ b/rand/seq/index/enum.IndexVecIter.html @@ -1,12 +1,12 @@ -rand::seq::index::IndexVecIter - Rust

[][src]Enum rand::seq::index::IndexVecIter

pub enum IndexVecIter<'a> {
+rand::seq::index::IndexVecIter - Rust

[][src]Enum rand::seq::index::IndexVecIter

pub enum IndexVecIter<'a> {
     // some variants omitted
 }

Return type of IndexVec::iter.

-

Trait Implementations

impl<'a> Debug for IndexVecIter<'a>[src]

impl<'a> ExactSizeIterator for IndexVecIter<'a>[src]

Trait Implementations

impl<'a> Debug for IndexVecIter<'a>[src]

impl<'a> ExactSizeIterator for IndexVecIter<'a>[src]

impl<'a> Iterator for IndexVecIter<'a>[src]

type Item = usize

The type of the elements being iterated over.

-

impl<'a> Iterator for IndexVecIter<'a>[src]

type Item = usize

The type of the elements being iterated over.

+

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

\ No newline at end of file +
\ No newline at end of file diff --git a/rand/seq/index/fn.sample.html b/rand/seq/index/fn.sample.html index ba5ae91..bba8588 100644 --- a/rand/seq/index/fn.sample.html +++ b/rand/seq/index/fn.sample.html @@ -1,4 +1,4 @@ -rand::seq::index::sample - Rust

[][src]Function rand::seq::index::sample

pub fn sample<R: ?Sized>(rng: &mut R, length: usize, amount: usize) -> IndexVec where
    R: Rng

Randomly sample exactly amount distinct indices from 0..length, and +rand::seq::index::sample - Rust

[][src]Function rand::seq::index::sample

pub fn sample<R: ?Sized>(rng: &mut R, length: usize, amount: usize) -> IndexVec where
    R: Rng

Randomly sample exactly amount distinct indices from 0..length, and return them in random order (fully shuffled).

This method is used internally by the slice sampling methods, but it can sometimes be useful to have the indices themselves so this is provided as diff --git a/rand/seq/index/index.html b/rand/seq/index/index.html index 0f7e76a..12ef19e 100644 --- a/rand/seq/index/index.html +++ b/rand/seq/index/index.html @@ -1,4 +1,4 @@ -rand::seq::index - Rust

[][src]Module rand::seq::index

Low-level API for sampling indices

+rand::seq::index - Rust

[][src]Module rand::seq::index

Index sampling

Enums

IndexVec

A vector of indices.

IndexVecIntoIter

Return type of IndexVec::into_iter.

diff --git a/rand/seq/sidebar-items.js b/rand/seq/sidebar-items.js index 7cccd4d..b3376dc 100644 --- a/rand/seq/sidebar-items.js +++ b/rand/seq/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"mod":[["index","Low-level API for sampling indices"]],"struct":[["SliceChooseIter","An iterator over multiple slice elements."]],"trait":[["IteratorRandom","Extension trait on iterators, providing random sampling methods."],["SliceRandom","Extension trait on slices, providing random mutation and sampling methods."]]}); \ No newline at end of file +initSidebarItems({"fn":[["sample_iter","Randomly sample `amount` elements from a finite iterator."],["sample_slice","Randomly sample exactly `amount` values from `slice`."],["sample_slice_ref","Randomly sample exactly `amount` references from `slice`."]],"mod":[["index","Index sampling"]],"struct":[["SliceChooseIter","Iterator over multiple choices, as returned by [`SliceRandom::choose_multiple]"]],"trait":[["IteratorRandom","Extension trait on iterators, providing random sampling methods."],["SliceRandom","Extension trait on slices, providing random mutation and sampling methods."]]}); \ No newline at end of file diff --git a/rand/seq/struct.SliceChooseIter.html b/rand/seq/struct.SliceChooseIter.html index 1fe9c53..e943045 100644 --- a/rand/seq/struct.SliceChooseIter.html +++ b/rand/seq/struct.SliceChooseIter.html @@ -1,12 +1,10 @@ -rand::seq::SliceChooseIter - Rust

[][src]Struct rand::seq::SliceChooseIter

pub struct SliceChooseIter<'a, S: ?Sized + 'a, T: 'a> { /* fields omitted */ }

An iterator over multiple slice elements.

-

This struct is created by -SliceRandom::choose_multiple.

-

Trait Implementations

impl<'a, S: Debug + ?Sized + 'a, T: Debug + 'a> Debug for SliceChooseIter<'a, S, T>[src]

impl<'a, S: Index<usize, Output = T> + ?Sized + 'a, T: 'a> ExactSizeIterator for SliceChooseIter<'a, S, T>[src]

\ No newline at end of file diff --git a/rand/seq/trait.IteratorRandom.html b/rand/seq/trait.IteratorRandom.html index b406fe8..69f6b93 100644 --- a/rand/seq/trait.IteratorRandom.html +++ b/rand/seq/trait.IteratorRandom.html @@ -1,4 +1,4 @@ -rand::seq::IteratorRandom - Rust

[][src]Trait rand::seq::IteratorRandom

pub trait IteratorRandom: Iterator + Sized {
+rand::seq::IteratorRandom - Rust

[][src]Trait rand::seq::IteratorRandom

pub trait IteratorRandom: Iterator + Sized {
     fn choose<R: ?Sized>(self, rng: &mut R) -> Option<Self::Item>
    where
        R: Rng
, { ... }
fn choose_multiple_fill<R: ?Sized>(
        self,
        rng: &mut R,
        buf: &mut [Self::Item]
    ) -> usize
    where
        R: Rng
, @@ -6,41 +6,23 @@
fn choose_multiple<R: ?Sized>(
        self,
        rng: &mut R,
        amount: usize
    ) -> Vec<Self::Item>
    where
        R: Rng
, { ... } }

Extension trait on iterators, providing random sampling methods.

-

This trait is implemented on all sized iterators, providing methods for -choosing one or more elements. You must use this trait:

- -
-use rand::seq::IteratorRandom;
-
-fn main() {
-    let mut rng = rand::thread_rng();
-     
-    let faces = "😀😎😐😕😠😢";
-    println!("I am {}!", faces.chars().choose(&mut rng).unwrap());
-}
-

Example output (non-deterministic):

-
I am 😀!
-
-

Provided methods

fn choose<R: ?Sized>(self, rng: &mut R) -> Option<Self::Item> where
    R: Rng

Choose one element at random from the iterator.

+

Provided methods

fn choose<R: ?Sized>(self, rng: &mut R) -> Option<Self::Item> where
    R: Rng

Choose one element at random from the iterator. If you have a slice, +it's significantly faster to call the choose or choose_mut +functions using the slice instead.

Returns None if and only if the iterator is empty.

-

This method uses [Iterator::size_hint] for optimisation. With an -accurate hint and where [Iterator::nth] is a constant-time operation -this method can offer O(1) performance. Where no size hint is -available, complexity is O(n) where n is the iterator length. -Partial hints (where lower > 0) also improve performance.

-

For slices, prefer [SliceRandom::choose] which guarantees O(1) -performance.

-

fn choose_multiple_fill<R: ?Sized>(
    self,
    rng: &mut R,
    buf: &mut [Self::Item]
) -> usize where
    R: Rng

Collects values at random from the iterator into a supplied buffer -until that buffer is filled.

+

Complexity is O(n), where n is the length of the iterator. +This likely consumes multiple random numbers, but the exact number +is unspecified.

+

fn choose_multiple_fill<R: ?Sized>(
    self,
    rng: &mut R,
    buf: &mut [Self::Item]
) -> usize where
    R: Rng

Collects amount values at random from the iterator into a supplied +buffer.

Although the elements are selected randomly, the order of elements in the buffer is neither stable nor fully random. If random ordering is desired, shuffle the result.

-

Returns the number of elements added to the buffer. This equals the length -of the buffer unless the iterator contains insufficient elements, in which -case this equals the number of elements available.

-

Complexity is O(n) where n is the length of the iterator. -For slices, prefer [SliceRandom::choose_multiple].

+

Returns the number of elements added to the buffer. This equals amount +unless the iterator contains insufficient elements, in which case this +equals the number of elements available.

+

Complexity is O(n) where n is the length of the iterator.

fn choose_multiple<R: ?Sized>(
    self,
    rng: &mut R,
    amount: usize
) -> Vec<Self::Item> where
    R: Rng

Collects amount values at random from the iterator into a vector.

This is equivalent to choose_multiple_fill except for the result type.

Although the elements are selected randomly, the order of elements in @@ -49,7 +31,6 @@ desired, shuffle the result.

The length of the returned vector equals amount unless the iterator contains insufficient elements, in which case it equals the number of elements available.

-

Complexity is O(n) where n is the length of the iterator. -For slices, prefer [SliceRandom::choose_multiple].

+

Complexity is O(n) where n is the length of the iterator.

Loading content... -

Implementors

impl<I> IteratorRandom for I where
    I: Iterator + Sized
[src]

Loading content...
\ No newline at end of file +

Implementors

impl<I> IteratorRandom for I where
    I: Iterator + Sized
[src]

Loading content...
\ No newline at end of file diff --git a/rand/seq/trait.SliceRandom.html b/rand/seq/trait.SliceRandom.html index 17b124e..dcb0174 100644 --- a/rand/seq/trait.SliceRandom.html +++ b/rand/seq/trait.SliceRandom.html @@ -1,35 +1,21 @@ -rand::seq::SliceRandom - Rust

[][src]Trait rand::seq::SliceRandom

pub trait SliceRandom {
+rand::seq::SliceRandom - Rust

[][src]Trait rand::seq::SliceRandom

pub trait SliceRandom {
     type Item;
     fn choose<R: ?Sized>(&self, rng: &mut R) -> Option<&Self::Item>
    where
        R: Rng
;
fn choose_mut<R: ?Sized>(&mut self, rng: &mut R) -> Option<&mut Self::Item>
    where
        R: Rng
;
fn choose_multiple<R: ?Sized>(
        &self,
        rng: &mut R,
        amount: usize
    ) -> SliceChooseIter<Self, Self::Item>
    where
        R: Rng
; -
fn choose_weighted<R: ?Sized, F, B, X>(
        &self,
        rng: &mut R,
        weight: F
    ) -> Result<&Self::Item, WeightedError>
    where
        R: Rng,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
; -
fn choose_weighted_mut<R: ?Sized, F, B, X>(
        &mut self,
        rng: &mut R,
        weight: F
    ) -> Result<&mut Self::Item, WeightedError>
    where
        R: Rng,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
; +
fn choose_weighted<R: ?Sized, F, B, X>(
        &self,
        rng: &mut R,
        weight: F
    ) -> Result<&Self::Item, WeightedError>
    where
        R: Rng,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
; +
fn choose_weighted_mut<R: ?Sized, F, B, X>(
        &mut self,
        rng: &mut R,
        weight: F
    ) -> Result<&mut Self::Item, WeightedError>
    where
        R: Rng,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
;
fn shuffle<R: ?Sized>(&mut self, rng: &mut R)
    where
        R: Rng
;
fn partial_shuffle<R: ?Sized>(
        &mut self,
        rng: &mut R,
        amount: usize
    ) -> (&mut [Self::Item], &mut [Self::Item])
    where
        R: Rng
; }

Extension trait on slices, providing random mutation and sampling methods.

-

This trait is implemented on all [T] slice types, providing several -methods for choosing and shuffling elements. You must use this trait:

- -
-use rand::seq::SliceRandom;
-
-fn main() {
-    let mut rng = rand::thread_rng();
-    let mut bytes = "Hello, random!".to_string().into_bytes();
-    bytes.shuffle(&mut rng);
-    let str = String::from_utf8(bytes).unwrap();
-    println!("{}", str);
-}
-

Example output (non-deterministic):

-
l,nmroHado !le
-
+

An implementation is provided for slices. This may also be implementable for +other types.

Associated Types

type Item

The element type.

Loading content...

Required methods

fn choose<R: ?Sized>(&self, rng: &mut R) -> Option<&Self::Item> where
    R: Rng

Returns a reference to one random element of the slice, or None if the slice is empty.

-

For slices, complexity is O(1).

+

Depending on the implementation, complexity is expected to be O(1).

Example

 use rand::thread_rng;
@@ -41,34 +27,31 @@ slice is empty.

assert_eq!(choices[..0].choose(&mut rng), None);

fn choose_mut<R: ?Sized>(&mut self, rng: &mut R) -> Option<&mut Self::Item> where
    R: Rng

Returns a mutable reference to one random element of the slice, or None if the slice is empty.

-

For slices, complexity is O(1).

-

fn choose_multiple<R: ?Sized>(
    &self,
    rng: &mut R,
    amount: usize
) -> SliceChooseIter<Self, Self::Item> where
    R: Rng

Chooses amount elements from the slice at random, without repetition, -and in random order. The returned iterator is appropriate both for -collection into a Vec and filling an existing buffer (see example).

-

In case this API is not sufficiently flexible, use [index::sample].

-

For slices, complexity is the same as [index::sample].

+

Depending on the implementation, complexity is expected to be O(1).

+

fn choose_multiple<R: ?Sized>(
    &self,
    rng: &mut R,
    amount: usize
) -> SliceChooseIter<Self, Self::Item> where
    R: Rng

Produces an iterator that chooses amount elements from the slice at +random without repeating any, and returns them in random order.

+

In case this API is not sufficiently flexible, use index::sample then +apply the indices to the slice.

+

Complexity is expected to be the same as index::sample.

Example

 use rand::seq::SliceRandom;
-
+ 
 let mut rng = &mut rand::thread_rng();
 let sample = "Hello, audience!".as_bytes();
-
+ 
 // collect the results into a vector:
 let v: Vec<u8> = sample.choose_multiple(&mut rng, 3).cloned().collect();
-
+ 
 // store in a buffer:
 let mut buf = [0u8; 5];
 for (b, slot) in sample.choose_multiple(&mut rng, buf.len()).zip(buf.iter_mut()) {
     *slot = *b;
 }
-

fn choose_weighted<R: ?Sized, F, B, X>(
    &self,
    rng: &mut R,
    weight: F
) -> Result<&Self::Item, WeightedError> where
    R: Rng,
    F: Fn(&Self::Item) -> B,
    B: SampleBorrow<X>,
    X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default

Similar to choose, but where the likelihood of each outcome may be -specified.

-

The specified function weight maps each item x to a relative +

fn choose_weighted<R: ?Sized, F, B, X>(
    &self,
    rng: &mut R,
    weight: F
) -> Result<&Self::Item, WeightedError> where
    R: Rng,
    F: Fn(&Self::Item) -> B,
    B: SampleBorrow<X>,
    X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default

Similar to choose, where the likelihood of each outcome may be +specified. The specified function weight maps items x to a relative likelihood weight(x). The probability of each item being selected is therefore weight(x) / s, where s is the sum of all weight(x).

-

For slices of length n, complexity is O(n). -See also choose_weighted_mut, distributions::weighted.

Example

-

fn choose_weighted_mut<R: ?Sized, F, B, X>(
    &mut self,
    rng: &mut R,
    weight: F
) -> Result<&mut Self::Item, WeightedError> where
    R: Rng,
    F: Fn(&Self::Item) -> B,
    B: SampleBorrow<X>,
    X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default

Similar to choose_mut, but where the likelihood of each outcome may -be specified.

-

The specified function weight maps each item x to a relative +

fn choose_weighted_mut<R: ?Sized, F, B, X>(
    &mut self,
    rng: &mut R,
    weight: F
) -> Result<&mut Self::Item, WeightedError> where
    R: Rng,
    F: Fn(&Self::Item) -> B,
    B: SampleBorrow<X>,
    X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default

Similar to choose_mut, where the likelihood of each outcome may be +specified. The specified function weight maps items x to a relative likelihood weight(x). The probability of each item being selected is therefore weight(x) / s, where s is the sum of all weight(x).

-

For slices of length n, complexity is O(n). -See also choose_weighted, distributions::weighted.

+

See also choose_weighted.

fn shuffle<R: ?Sized>(&mut self, rng: &mut R) where
    R: Rng

Shuffle a mutable slice in place.

-

For slices of length n, complexity is O(n).

+

Depending on the implementation, complexity is expected to be O(1).

Example

-use rand::seq::SliceRandom;
 use rand::thread_rng;
+use rand::seq::SliceRandom;
 
 let mut rng = thread_rng();
 let mut y = [1, 2, 3, 4, 5];
@@ -107,7 +88,7 @@ then you may improve performance by taking
 amount = values.len() - amount and using only the second slice.

If amount is greater than the number of elements in the slice, this will perform a full shuffle.

-

For slices, complexity is O(m) where m = amount.

+

Complexity is expected to be O(m) where m = amount.

Loading content... -

Implementations on Foreign Types

impl<T> SliceRandom for [T][src]

type Item = T

Loading content... +

Implementations on Foreign Types

impl<T> SliceRandom for [T][src]

type Item = T

Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/rand/sidebar-items.js b/rand/sidebar-items.js index e3933f0..f4b98c1 100644 --- a/rand/sidebar-items.js +++ b/rand/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"fn":[["random","Generates a random value using the thread-local random number generator."],["thread_rng","Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. `thread_rng().gen::()`, or cached locally, e.g. `let mut rng = thread_rng();`. Invoked by the `Default` trait, making `ThreadRng::default()` equivalent."]],"mod":[["distributions","Generating random samples from probability distributions"],["prelude","Convenience re-export of common members"],["rngs","Random number generators and adapters"],["seq","Sequence-related functionality"]],"struct":[["Error","Error type of random number generators"]],"trait":[["AsByteSliceMut","Trait for casting types to byte slices"],["CryptoRng","A marker trait used to indicate that an [`RngCore`] or [`BlockRngCore`] implementation is supposed to be cryptographically secure."],["Rng","An automatically-implemented extension trait on [`RngCore`] providing high-level generic methods for sampling values and other convenience methods."],["RngCore","The core of a random number generator."],["SeedableRng","A random number generator that can be explicitly seeded."]]}); \ No newline at end of file +initSidebarItems({"enum":[["ErrorKind","Error kind which can be matched over."]],"fn":[["random","Generates a random value using the thread-local random number generator."],["thread_rng","Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. `thread_rng().gen::()`, or cached locally, e.g. `let mut rng = thread_rng();`. Invoked by the `Default` trait, making `ThreadRng::default()` equivelent."]],"mod":[["distributions","Generating random samples from probability distributions."],["prelude","Convenience re-export of common members"],["prng","Pseudo-random number generators."],["rngs","Random number generators and adapters for common usage:"],["seq","Functions for randomly accessing and sampling sequences."]],"struct":[["Error","Error type of random number generators"]],"trait":[["AsByteSliceMut","Trait for casting types to byte slices"],["CryptoRng","A marker trait used to indicate that an [`RngCore`] or [`BlockRngCore`] implementation is supposed to be cryptographically secure."],["FromEntropy","A convenience extension to [`SeedableRng`] allowing construction from fresh entropy. This trait is automatically implemented for any PRNG implementing [`SeedableRng`] and is not intended to be implemented by users."],["Rng","An automatically-implemented extension trait on [`RngCore`] providing high-level generic methods for sampling values and other convenience methods."],["RngCore","The core of a random number generator."],["SeedableRng","A random number generator that can be explicitly seeded."]]}); \ No newline at end of file diff --git a/rand/struct.Error.html b/rand/struct.Error.html index 88dd53c..591eca9 100644 --- a/rand/struct.Error.html +++ b/rand/struct.Error.html @@ -1,46 +1,43 @@ -rand::Error - Rust

[][src]Struct rand::Error

pub struct Error { /* fields omitted */ }

Error type of random number generators

-

In order to be compatible with std and no_std, this type has two -possible implementations: with std a boxed Error trait object is stored, -while with no_std we merely store an error code.

-

Methods

impl Error[src]

pub fn new<E>(err: E) -> Error where
    E: Into<Box<dyn Error + 'static + Sync + Send>>, 
[src]

Construct from any type supporting std::error::Error

-

Available only when configured with std.

-

See also From<NonZeroU32>, which is available with and without std.

-

pub fn inner(&self) -> &(dyn Error + 'static + Sync + Send)[src]

Reference the inner error (std only)

-

When configured with std, this is a trivial operation and never -panics. Without std, this method is simply unavailable.

-

pub fn take_inner(self) -> Box<dyn Error + 'static + Sync + Send>[src]

Unwrap the inner error (std only)

-

When configured with std, this is a trivial operation and never -panics. Without std, this method is simply unavailable.

-

pub const INTERNAL_START: u32[src]

Codes below this point represent OS Errors (i.e. positive i32 values). -Codes at or above this point, but below [Error::CUSTOM_START] are -reserved for use by the rand and getrandom crates.

-

pub const CUSTOM_START: u32[src]

Codes at or above this point can be used by users to define their own -custom errors.

-

pub fn raw_os_error(&self) -> Option<i32>[src]

Extract the raw OS error code (if this error came from the OS)

-

This method is identical to std::io::Error::raw_os_error(), except -that it works in no_std contexts. If this method returns None, the -error value can still be formatted via the Diplay implementation.

-

pub fn code(&self) -> Option<NonZeroU32>[src]

Retrieve the error code, if any.

-

If this Error was constructed via From<NonZeroU32>, then this method -will return this NonZeroU32 code (for no_std this is always the -case). Otherwise, this method will return None.

-

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

\ No newline at end of file diff --git a/rand/trait.AsByteSliceMut.html b/rand/trait.AsByteSliceMut.html index 2c03ed8..396527d 100644 --- a/rand/trait.AsByteSliceMut.html +++ b/rand/trait.AsByteSliceMut.html @@ -1,4 +1,4 @@ -rand::AsByteSliceMut - Rust

[][src]Trait rand::AsByteSliceMut

pub trait AsByteSliceMut {
+rand::AsByteSliceMut - Rust

[][src]Trait rand::AsByteSliceMut

pub trait AsByteSliceMut {
     fn as_byte_slice_mut(&mut self) -> &mut [u8];
 
fn to_le(&mut self); }

Trait for casting types to byte slices

@@ -7,5 +7,5 @@

Required methods

fn as_byte_slice_mut(&mut self) -> &mut [u8]

Return a mutable reference to self as a byte slice

fn to_le(&mut self)

Call to_le on each element (i.e. byte-swap on Big Endian platforms).

Loading content... -

Implementations on Foreign Types

impl AsByteSliceMut for [u8][src]

impl AsByteSliceMut for [u16][src]

impl AsByteSliceMut for [Wrapping<u16>][src]

impl AsByteSliceMut for [u32][src]

impl AsByteSliceMut for [Wrapping<u32>][src]

impl AsByteSliceMut for [u64][src]

impl AsByteSliceMut for [Wrapping<u64>][src]

impl AsByteSliceMut for [usize][src]

impl AsByteSliceMut for [Wrapping<usize>][src]

impl AsByteSliceMut for [u128][src]

impl AsByteSliceMut for [Wrapping<u128>][src]

impl AsByteSliceMut for [i8][src]

impl AsByteSliceMut for [Wrapping<i8>][src]

impl AsByteSliceMut for [i16][src]

impl AsByteSliceMut for [Wrapping<i16>][src]

impl AsByteSliceMut for [i32][src]

impl AsByteSliceMut for [Wrapping<i32>][src]

impl AsByteSliceMut for [i64][src]

impl AsByteSliceMut for [Wrapping<i64>][src]

impl AsByteSliceMut for [isize][src]

impl AsByteSliceMut for [Wrapping<isize>][src]

impl AsByteSliceMut for [i128][src]

impl AsByteSliceMut for [Wrapping<i128>][src]

impl<T> AsByteSliceMut for [T; 32] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 31] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 30] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 29] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 28] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 27] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 26] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 25] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 24] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 23] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 22] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 21] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 20] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 19] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 18] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 17] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 16] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 15] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 14] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 13] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 12] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 11] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 10] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 9] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 8] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 7] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 6] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 5] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 4] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 3] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 2] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 1] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 0] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 4096] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 2048] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 1024] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 512] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 256] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 128] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 64] where
    [T]: AsByteSliceMut
[src]

Loading content... +

Implementations on Foreign Types

impl AsByteSliceMut for [u8][src]

impl AsByteSliceMut for [u16][src]

impl AsByteSliceMut for [u32][src]

impl AsByteSliceMut for [u64][src]

impl AsByteSliceMut for [u128][src]

impl AsByteSliceMut for [usize][src]

impl AsByteSliceMut for [i8][src]

impl AsByteSliceMut for [i16][src]

impl AsByteSliceMut for [i32][src]

impl AsByteSliceMut for [i64][src]

impl AsByteSliceMut for [i128][src]

impl AsByteSliceMut for [isize][src]

impl<T> AsByteSliceMut for [T; 0] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 1] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 2] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 3] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 4] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 5] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 6] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 7] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 8] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 9] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 10] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 11] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 12] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 13] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 14] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 15] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 16] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 17] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 18] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 19] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 20] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 21] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 22] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 23] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 24] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 25] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 26] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 27] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 28] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 29] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 30] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 31] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 32] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 64] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 128] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 256] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 512] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 1024] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 2048] where
    [T]: AsByteSliceMut
[src]

impl<T> AsByteSliceMut for [T; 4096] where
    [T]: AsByteSliceMut
[src]

Loading content...

Implementors

Loading content...
\ No newline at end of file diff --git a/rand/trait.CryptoRng.html b/rand/trait.CryptoRng.html index 728f1af..37ed0c8 100644 --- a/rand/trait.CryptoRng.html +++ b/rand/trait.CryptoRng.html @@ -1,4 +1,4 @@ -rand::CryptoRng - Rust

[][src]Trait rand::CryptoRng

pub trait CryptoRng { }

A marker trait used to indicate that an [RngCore] or BlockRngCore +rand::CryptoRng - Rust

[][src]Trait rand::CryptoRng

pub trait CryptoRng { }

A marker trait used to indicate that an [RngCore] or BlockRngCore implementation is supposed to be cryptographically secure.

Cryptographically secure generators, also known as CSPRNGs, should satisfy an additional properties over other generators: given the first @@ -15,5 +15,5 @@ implemented for well-reviewed code implementing well-regarded algorithms.

Note also that use of a CryptoRng does not protect against other weaknesses such as seeding from a weak entropy source or leaking state.

-

Implementations on Foreign Types

impl<R> CryptoRng for Box<R> where
    R: CryptoRng + ?Sized
[src]

impl<'a, R> CryptoRng for &'a mut R where
    R: CryptoRng + ?Sized
[src]

impl<R> CryptoRng for BlockRng<R> where
    R: BlockRngCore + CryptoRng
[src]

impl CryptoRng for ChaCha12Core[src]

impl CryptoRng for ChaCha20Rng[src]

impl CryptoRng for ChaCha12Rng[src]

impl CryptoRng for ChaCha8Core[src]

impl CryptoRng for ChaCha8Rng[src]

impl CryptoRng for ChaCha20Core[src]

Loading content... -

Implementors

impl CryptoRng for EntropyRng[src]

impl CryptoRng for OsRng[src]

impl CryptoRng for StdRng[src]

impl CryptoRng for ThreadRng[src]

impl<R, Rsdr> CryptoRng for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + CryptoRng,
    Rsdr: RngCore + CryptoRng
[src]

Loading content...
\ No newline at end of file +

Implementations on Foreign Types

impl<R> CryptoRng for BlockRng<R> where
    R: BlockRngCore + CryptoRng
[src]

impl<R> CryptoRng for Box<R> where
    R: CryptoRng + ?Sized
[src]

impl<'a, R> CryptoRng for &'a mut R where
    R: CryptoRng + ?Sized
[src]

impl CryptoRng for ChaChaCore[src]

impl CryptoRng for ChaChaRng[src]

impl CryptoRng for Hc128Core[src]

impl CryptoRng for Hc128Rng[src]

Loading content... +

Implementors

impl CryptoRng for EntropyRng[src]

impl CryptoRng for JitterRng[src]

impl CryptoRng for OsRng[src]

impl CryptoRng for StdRng[src]

impl CryptoRng for ThreadRng[src]

impl<R, Rsdr> CryptoRng for ReseedingRng<R, Rsdr> where
    R: BlockRngCore + SeedableRng + CryptoRng,
    Rsdr: RngCore + CryptoRng
[src]

Loading content...
\ No newline at end of file diff --git a/rand/trait.Rng.html b/rand/trait.Rng.html index 3076793..93b01ea 100644 --- a/rand/trait.Rng.html +++ b/rand/trait.Rng.html @@ -1,15 +1,18 @@ -rand::Rng - Rust

[][src]Trait rand::Rng

pub trait Rng: RngCore {
+rand::Rng - Rust

[][src]Trait rand::Rng

pub trait Rng: RngCore {
     fn gen<T>(&mut self) -> T
    where
        Standard: Distribution<T>
, { ... }
fn gen_range<T: SampleUniform, B1, B2>(&mut self, low: B1, high: B2) -> T
    where
        B1: SampleBorrow<T> + Sized,
        B2: SampleBorrow<T> + Sized
, { ... }
fn sample<T, D: Distribution<T>>(&mut self, distr: D) -> T { ... } -
fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>
    where
        D: Distribution<T>,
        Self: Sized
, +
fn sample_iter<'a, T, D: Distribution<T>>(
        &'a mut self,
        distr: &'a D
    ) -> DistIter<'a, D, Self, T>
    where
        Self: Sized
, { ... }
fn fill<T: AsByteSliceMut + ?Sized>(&mut self, dest: &mut T) { ... }
fn try_fill<T: AsByteSliceMut + ?Sized>(
        &mut self,
        dest: &mut T
    ) -> Result<(), Error> { ... }
fn gen_bool(&mut self, p: f64) -> bool { ... }
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool { ... } +
fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> { ... } +
fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T> { ... } +
fn shuffle<T>(&mut self, values: &mut [T]) { ... } }

An automatically-implemented extension trait on [RngCore] providing high-level generic methods for sampling values and other convenience methods.

This is the primary trait to use when generating random values.

@@ -50,22 +53,6 @@ optimiser can remove redundant references later.

let x: u32 = rng.gen(); println!("{}", x); println!("{:?}", rng.gen::<(f64, bool)>());
-

Arrays and tuples

-

The rng.gen() method is able to generate arrays (up to 32 elements) -and tuples (up to 12 elements), so long as all element types can be -generated.

-

For arrays of integers, especially for those with small element types -(< 64 bit), it will likely be faster to instead use [Rng::fill].

- -
-use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-let tuple: (u8, i32, char) = rng.gen(); // arbitrary tuple support
-
-let arr1: [f32; 32] = rng.gen();        // array construction
-let mut arr2 = [0u8; 128];
-rng.fill(&mut arr2);                    // array fill

fn gen_range<T: SampleUniform, B1, B2>(&mut self, low: B1, high: B2) -> T where
    B1: SampleBorrow<T> + Sized,
    B2: SampleBorrow<T> + Sized

Generate a random value in the range [low, high), i.e. inclusive of low and exclusive of high.

This function is optimised for the case that only a single sample is @@ -93,32 +80,27 @@ type which may be faster if sampling from the same range repeatedly.

// Type annotation requires two types, the type and distribution; the // distribution can be inferred. let y = rng.sample::<u16, _>(Uniform::new(10, 15));
-

fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T> where
    D: Distribution<T>,
    Self: Sized

Create an iterator that generates values using the given distribution.

-

Note that this function takes its arguments by value. This works since -(&mut R): Rng where R: Rng and -(&D): Distribution where D: Distribution, -however borrowing is not automatic hence rng.sample_iter(...) may -need to be replaced with (&mut rng).sample_iter(...).

+

fn sample_iter<'a, T, D: Distribution<T>>(
    &'a mut self,
    distr: &'a D
) -> DistIter<'a, D, Self, T> where
    Self: Sized

Create an iterator that generates values using the given distribution.

Example

 use rand::{thread_rng, Rng};
 use rand::distributions::{Alphanumeric, Uniform, Standard};
 
-let rng = thread_rng();
+let mut rng = thread_rng();
 
 // Vec of 16 x f32:
-let v: Vec<f32> = rng.sample_iter(Standard).take(16).collect();
+let v: Vec<f32> = thread_rng().sample_iter(&Standard).take(16).collect();
 
 // String:
-let s: String = rng.sample_iter(Alphanumeric).take(7).collect();
+let s: String = rng.sample_iter(&Alphanumeric).take(7).collect();
 
 // Combined values
-println!("{:?}", rng.sample_iter(Standard).take(5)
+println!("{:?}", thread_rng().sample_iter(&Standard).take(5)
                              .collect::<Vec<(f64, bool)>>());
 
 // Dice-rolling:
 let die_range = Uniform::new_inclusive(1, 6);
-let mut roll_die = rng.sample_iter(die_range);
+let mut roll_die = rng.sample_iter(&die_range);
 while roll_die.next().unwrap() != 6 {
     println!("Not a 6; rolling again!");
 }
@@ -141,8 +123,10 @@ where dest is any type supporting [AsByteSliceMut], na and arrays over primitive integer types (i8, i16, u32, etc.).

On big-endian platforms this performs byte-swapping to ensure portability of results from reproducible generators.

-

This is identical to fill except that it uses try_fill_bytes -internally and forwards RNG errors.

+

This uses try_fill_bytes internally and forwards all RNG errors. In +some cases errors may be resolvable; see [ErrorKind] and +documentation for the RNG in use. If you do not plan to handle these +errors you may prefer to use fill.

Example

 use rand::{thread_rng, Rng};
@@ -176,5 +160,14 @@ sampling from the same numerator and denominator repea
 
 let mut rng = thread_rng();
 println!("{}", rng.gen_ratio(2, 3));
+

fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T>

Deprecated since 0.6.0:

use SliceRandom::choose instead

+

Return a random element from values.

+

Deprecated: use [seq::SliceRandom::choose] instead.

+

fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T>

Deprecated since 0.6.0:

use SliceRandom::choose_mut instead

+

Return a mutable pointer to a random element from values.

+

Deprecated: use [seq::SliceRandom::choose_mut] instead.

+

fn shuffle<T>(&mut self, values: &mut [T])

Deprecated since 0.6.0:

use SliceRandom::shuffle instead

+

Shuffle a mutable slice in place.

+

Deprecated: use [seq::SliceRandom::shuffle] instead.

Loading content... -

Implementors

impl<R: RngCore + ?Sized> Rng for R[src]

Loading content...
\ No newline at end of file +

Implementors

impl<R: RngCore + ?Sized> Rng for R[src]

Loading content... \ No newline at end of file diff --git a/rand/trait.RngCore.html b/rand/trait.RngCore.html index 01a7c26..480c588 100644 --- a/rand/trait.RngCore.html +++ b/rand/trait.RngCore.html @@ -1,4 +1,4 @@ -rand::RngCore - Rust

[][src]Trait rand::RngCore

pub trait RngCore {
+rand::RngCore - Rust

[][src]Trait rand::RngCore

pub trait RngCore {
     fn next_u32(&mut self) -> u32;
 
fn next_u64(&mut self) -> u64;
fn fill_bytes(&mut self, dest: &mut [u8]); @@ -97,7 +97,7 @@ directly to generate keys and to seed (infallible) PRNGs.

thus this may be implemented using Ok(self.fill_bytes(dest)) or fill_bytes may be implemented with self.try_fill_bytes(dest).unwrap() or more specific error handling.

-
Loading content...

Trait Implementations

impl Read for dyn RngCore + 'static[src]

Loading content...

Trait Implementations

impl Read for dyn RngCore + 'static[src]

-

Implementations on Foreign Types

impl<R> RngCore for BlockRng64<R> where
    R: BlockRngCore<Item = u64>,
    <R as BlockRngCore>::Results: AsRef<[u64]>,
    <R as BlockRngCore>::Results: AsMut<[u64]>, 
[src]

impl<R> RngCore for BlockRng<R> where
    R: BlockRngCore<Item = u32>,
    <R as BlockRngCore>::Results: AsRef<[u32]>,
    <R as BlockRngCore>::Results: AsMut<[u32]>, 
[src]

impl<'a, R> RngCore for &'a mut R where
    R: RngCore + ?Sized
[src]

impl<R> RngCore for Box<R> where
    R: RngCore + ?Sized
[src]

impl RngCore for ChaCha12Rng[src]

impl RngCore for ChaCha20Rng[src]

impl RngCore for ChaCha8Rng[src]

Loading content... -

Implementors

impl RngCore for StepRng[src]

impl RngCore for EntropyRng[src]

impl RngCore for OsRng[src]

impl RngCore for StdRng[src]

impl RngCore for ThreadRng[src]

impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

impl<R: Read> RngCore for ReadRng<R>[src]

Loading content...
\ No newline at end of file +

Implementations on Foreign Types

impl<R> RngCore for BlockRng64<R> where
    R: BlockRngCore<Item = u64>,
    <R as BlockRngCore>::Results: AsRef<[u64]>,
    <R as BlockRngCore>::Results: AsMut<[u64]>, 
[src]

impl<R> RngCore for BlockRng<R> where
    R: BlockRngCore<Item = u32>,
    <R as BlockRngCore>::Results: AsRef<[u32]>,
    <R as BlockRngCore>::Results: AsMut<[u32]>, 
[src]

impl<R> RngCore for Box<R> where
    R: RngCore + ?Sized
[src]

impl<'a, R> RngCore for &'a mut R where
    R: RngCore + ?Sized
[src]

impl RngCore for Isaac64Rng[src]

impl RngCore for IsaacRng[src]

impl RngCore for ChaChaRng[src]

impl RngCore for Hc128Rng[src]

impl RngCore for Mcg128Xsl64[src]

impl RngCore for Lcg64Xsh32[src]

impl RngCore for XorShiftRng[src]

Loading content... +

Implementors

impl RngCore for StepRng[src]

impl RngCore for EntropyRng[src]

impl RngCore for JitterRng[src]

impl RngCore for OsRng[src]

impl RngCore for SmallRng[src]

impl RngCore for StdRng[src]

impl RngCore for ThreadRng[src]

impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr> where
    R: BlockRngCore<Item = u32> + SeedableRng,
    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>, 
[src]

impl<R: Read> RngCore for ReadRng<R>[src]

Loading content... \ No newline at end of file diff --git a/rand/trait.SeedableRng.html b/rand/trait.SeedableRng.html index 7475c84..4a67a52 100644 --- a/rand/trait.SeedableRng.html +++ b/rand/trait.SeedableRng.html @@ -1,14 +1,16 @@ -rand::SeedableRng - Rust

[][src]Trait rand::SeedableRng

pub trait SeedableRng {
+rand::SeedableRng - Rust

[][src]Trait rand::SeedableRng

pub trait SeedableRng {
     type Seed: AsMut<[u8]> + Default + Sized;
     fn from_seed(seed: Self::Seed) -> Self;
 
     fn seed_from_u64(state: u64) -> Self { ... }
 
fn from_rng<R>(rng: R) -> Result<Self, Error>
    where
        R: RngCore
, { ... } -
fn from_entropy() -> Self { ... } }

A random number generator that can be explicitly seeded.

This trait encapsulates the low-level functionality common to all pseudo-random number generators (PRNGs, or algorithmic generators).

+

The FromEntropy trait from the rand crate is automatically +implemented for every type implementing SeedableRng, providing +a convenient from_entropy() constructor.

Associated Types

type Seed: AsMut<[u8]> + Default + Sized

Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we recommend [u8; N] for some N).

@@ -53,16 +55,12 @@ used:

Required methods

fn from_seed(seed: Self::Seed) -> Self

Create a new PRNG using the given seed.

PRNG implementations are allowed to assume that bits in the seed are well distributed. That means usually that the number of one and zero -bits are roughly equal, and values like 0, 1 and (size - 1) are unlikely. -Note that many non-cryptographic PRNGs will show poor quality output -if this is not adhered to. If you wish to seed from simple numbers, use -seed_from_u64 instead.

-

All PRNG implementations should be reproducible unless otherwise noted: -given a fixed seed, the same sequence of output should be produced -on all runs, library versions and architectures (e.g. check endianness). -Any "value-breaking" changes to the generator should require bumping at -least the minor version and documentation of the change.

-

It is not required that this function yield the same state as a +bits are about equal, and values like 0, 1 and (size - 1) are unlikely.

+

PRNG implementations are recommended to be reproducible. A PRNG seeded +using this function with a fixed seed should produce the same sequence +of output in the future and on different architectures (with for example +different endianness).

+

It is however not required that this function yield the same state as a reference implementation of the PRNG given equivalent seed; if necessary another constructor replicating behaviour from a reference implementation can be added.

@@ -84,31 +82,44 @@ this function, but the default implementation should be good enough for all purposes. Changing the implementation of this function should be considered a value-breaking change.

fn from_rng<R>(rng: R) -> Result<Self, Error> where
    R: RngCore

Create a new PRNG seeded from another Rng.

-

This may be useful when needing to rapidly seed many PRNGs from a master -PRNG, and to allow forking of PRNGs. It may be considered deterministic.

-

The master PRNG should be at least as high quality as the child PRNGs. -When seeding non-cryptographic child PRNGs, we recommend using a -different algorithm for the master PRNG (ideally a CSPRNG) to avoid -correlations between the child PRNGs. If this is not possible (e.g. -forking using small non-crypto PRNGs) ensure that your PRNG has a good -mixing function on the output or consider use of a hash function with -from_seed.

-

Note that seeding XorShiftRng from another XorShiftRng provides an -extreme example of what can go wrong: the new PRNG will be a clone -of the parent.

+

This is the recommended way to initialize PRNGs with fresh entropy. The +FromEntropy trait from the rand crate provides a convenient +from_entropy method based on from_rng.

+

Usage of this method is not recommended when reproducibility is required +since implementing PRNGs are not required to fix Endianness and are +allowed to modify implementations in new releases.

+

It is important to use a good source of randomness to initialize the +PRNG. Cryptographic PRNG may be rendered insecure when seeded from a +non-cryptographic PRNG or with insufficient entropy. +Many non-cryptographic PRNGs will show statistical bias in their first +results if their seed numbers are small or if there is a simple pattern +between them.

+

Prefer to seed from a strong external entropy source like OsRng from +the rand_os crate or from a cryptographic PRNG; if creating a new +generator for cryptographic uses you must seed from a strong source.

+

Seeding a small PRNG from another small PRNG is possible, but +something to be careful with. An extreme example of how this can go +wrong is seeding an Xorshift RNG from another Xorshift RNG, which +will effectively clone the generator. In general seeding from a +generator which is hard to predict is probably okay.

PRNG implementations are allowed to assume that a good RNG is provided -for seeding, and that it is cryptographically secure when appropriate. -As of rand 0.7 / rand_core 0.5, implementations overriding this -method should ensure the implementation satisfies reproducibility -(in prior versions this was not required).

-

fn from_entropy() -> Self

Creates a new instance of the RNG seeded via getrandom.

-

This method is the recommended way to construct non-deterministic PRNGs -since it is convenient and secure.

-

In case the overhead of using getrandom to seed many PRNGs is an -issue, one may prefer to seed from a local PRNG, e.g. -from_rng(thread_rng()).unwrap().

-

Panics

-

If getrandom is unable to provide secure entropy this method will panic.

+for seeding, and that it is cryptographically secure when appropriate.

Loading content... -

Implementations on Foreign Types

impl<R> SeedableRng for BlockRng64<R> where
    R: BlockRngCore + SeedableRng
[src]

type Seed = <R as SeedableRng>::Seed

impl<R> SeedableRng for BlockRng<R> where
    R: BlockRngCore + SeedableRng
[src]

type Seed = <R as SeedableRng>::Seed

impl SeedableRng for ChaCha8Rng[src]

impl SeedableRng for ChaCha8Core[src]

impl SeedableRng for ChaCha12Core[src]

impl SeedableRng for ChaCha20Rng[src]

impl SeedableRng for ChaCha20Core[src]

impl SeedableRng for ChaCha12Rng[src]

Loading content... -

Implementors

impl SeedableRng for StdRng[src]

type Seed = <Rng as SeedableRng>::Seed

Loading content...
\ No newline at end of file +

Implementations on Foreign Types

impl<R> SeedableRng for BlockRng<R> where
    R: BlockRngCore + SeedableRng
[src]

type Seed = <R as SeedableRng>::Seed

impl<R> SeedableRng for BlockRng64<R> where
    R: BlockRngCore + SeedableRng
[src]

type Seed = <R as SeedableRng>::Seed

impl SeedableRng for Isaac64Rng[src]

type Seed = <Isaac64Core as SeedableRng>::Seed

fn seed_from_u64(seed: u64) -> Isaac64Rng[src]

Create an ISAAC random number generator using an u64 as seed. +If seed == 0 this will produce the same stream of random numbers as +the reference implementation when used unseeded.

+

impl SeedableRng for Isaac64Core[src]

impl SeedableRng for IsaacCore[src]

type Seed = [u8; 32]

fn seed_from_u64(seed: u64) -> IsaacCore[src]

Create an ISAAC random number generator using an u64 as seed. +If seed == 0 this will produce the same stream of random numbers as +the reference implementation when used unseeded.

+

impl SeedableRng for IsaacRng[src]

type Seed = <IsaacCore as SeedableRng>::Seed

fn seed_from_u64(seed: u64) -> IsaacRng[src]

Create an ISAAC random number generator using an u64 as seed. +If seed == 0 this will produce the same stream of random numbers as +the reference implementation when used unseeded.

+

impl SeedableRng for ChaChaRng[src]

type Seed = <ChaChaCore as SeedableRng>::Seed

impl SeedableRng for ChaChaCore[src]

impl SeedableRng for Hc128Core[src]

type Seed = [u8; 32]

fn from_seed(seed: <Hc128Core as SeedableRng>::Seed) -> Hc128Core[src]

Create an HC-128 random number generator with a seed. The seed has to be +256 bits in length, matching the 128 bit key followed by 128 bit iv +when HC-128 where to be used as a stream cipher.

+

impl SeedableRng for Hc128Rng[src]

type Seed = <Hc128Core as SeedableRng>::Seed

impl SeedableRng for Lcg64Xsh32[src]

We use a single 127-bit seed to initialise the state and select a stream. +One seed bit (lowest bit of seed[8]) is ignored.

+

impl SeedableRng for Mcg128Xsl64[src]

We use a single 126-bit seed to initialise the state and select a stream. +Two seed bits (lowest order of last byte) are ignored.

+

impl SeedableRng for XorShiftRng[src]

type Seed = [u8; 16]

Loading content... +

Implementors

impl SeedableRng for SmallRng[src]

type Seed = <Pcg64Mcg as SeedableRng>::Seed

impl SeedableRng for StdRng[src]

type Seed = <Hc128Rng as SeedableRng>::Seed

Loading content...
\ No newline at end of file diff --git a/search-index.js b/search-index.js index 730928d..3b640c5 100644 --- a/search-index.js +++ b/search-index.js @@ -98,7 +98,7 @@ searchIndex["proc_macro2"] = {"doc":"A wrapper around the procedural macro API o searchIndex["proc_macro_hack"] = {"doc":"As of Rust 1.30, the language supports user-defined…","i":[[23,"proc_macro_hack","proc_macro_hack","",null,null]],"p":[]}; searchIndex["quick_error"] = {"doc":"A macro which makes errors easy to write","i":[[3,"Context","quick_error","Generic context type",null,null],[12,"0","","",0,null],[12,"1","","",0,null],[8,"ResultExt","","Result extension trait adding a `context` method",null,null],[10,"context","","The method is use to add context information to current…",1,[[["x"]],[["context"],["result",["context"]]]]],[14,"quick_error","","Main macro that does all the work",null,null],[11,"from","","",0,[[["t"]],["t"]]],[11,"into","","",0,[[],["u"]]],[11,"try_from","","",0,[[["u"]],["result"]]],[11,"try_into","","",0,[[],["result"]]],[11,"borrow","","",0,[[["self"]],["t"]]],[11,"borrow_mut","","",0,[[["self"]],["t"]]],[11,"type_id","","",0,[[["self"]],["typeid"]]],[11,"fmt","","",0,[[["formatter"],["self"]],["result"]]]],"p":[[3,"Context"],[8,"ResultExt"]]}; searchIndex["quote"] = {"doc":"This crate provides the [`quote!`] macro for turning Rust…","i":[[8,"TokenStreamExt","quote","TokenStream extension trait with methods for appending…",null,null],[10,"append","","For use by `ToTokens` implementations.",0,[[["u"],["self"]]]],[10,"append_all","","For use by `ToTokens` implementations.",0,[[["self"],["i"]]]],[10,"append_separated","","For use by `ToTokens` implementations.",0,[[["u"],["self"],["i"]]]],[10,"append_terminated","","For use by `ToTokens` implementations.",0,[[["u"],["self"],["i"]]]],[8,"ToTokens","","Types that can be interpolated inside a [`quote!`]…",null,null],[10,"to_tokens","","Write `self` to the given `TokenStream`.",1,[[["tokenstream"],["self"]]]],[11,"into_token_stream","","Convert `self` directly into a `TokenStream` object.",1,[[],["tokenstream"]]],[14,"quote","","The whole point.",null,null],[14,"quote_spanned","","Same as `quote!`, but applies a given span to all tokens…",null,null],[11,"into_token_stream","","Convert `self` directly into a `TokenStream` object.",1,[[],["tokenstream"]]]],"p":[[8,"TokenStreamExt"],[8,"ToTokens"]]}; -searchIndex["rand"] = {"doc":"Utilities for random number generation","i":[[8,"CryptoRng","rand","A marker trait used to indicate that an [`RngCore`] or…",null,null],[3,"Error","","Error type of random number generators",null,null],[8,"RngCore","","The core of a random number generator.",null,null],[10,"next_u32","","Return the next random `u32`.",0,[[["self"]],["u32"]]],[10,"next_u64","","Return the next random `u64`.",0,[[["self"]],["u64"]]],[10,"fill_bytes","","Fill `dest` with random data.",0,[[["self"]]]],[10,"try_fill_bytes","","Fill `dest` entirely with random data.",0,[[["self"]],[["error"],["result",["error"]]]]],[8,"SeedableRng","","A random number generator that can be explicitly seeded.",null,null],[16,"Seed","","Seed type, which is restricted to types…",1,null],[10,"from_seed","","Create a new PRNG using the given seed.",1,[[],["self"]]],[11,"seed_from_u64","","Create a new PRNG using a `u64` seed.",1,[[["u64"]],["self"]]],[11,"from_rng","","Create a new PRNG seeded from another `Rng`.",1,[[["r"]],[["error"],["result",["error"]]]]],[11,"from_entropy","","Creates a new instance of the RNG seeded via [`getrandom`].",1,[[],["self"]]],[5,"thread_rng","","Retrieve the lazily-initialized thread-local random number…",null,[[],["threadrng"]]],[5,"random","","Generates a random value using the thread-local random…",null,[[],["t"]]],[0,"distributions","","Generating random samples from probability distributions",null,null],[3,"Bernoulli","rand::distributions","The Bernoulli distribution.",null,null],[3,"Open01","","A distribution to sample floating point numbers uniformly…",null,null],[3,"OpenClosed01","","A distribution to sample floating point numbers uniformly…",null,null],[3,"Alphanumeric","","Sample a `char`, uniformly distributed over ASCII letters…",null,null],[3,"Uniform","","Sample values uniformly between two bounds.",null,null],[3,"Binomial","","The binomial distribution `Binomial(n, p)`.",null,null],[3,"Cauchy","","The Cauchy distribution `Cauchy(median, scale)`.",null,null],[3,"Dirichlet","","The dirichelet distribution `Dirichlet(alpha)`.",null,null],[3,"Exp","","The exponential distribution `Exp(lambda)`.",null,null],[3,"Exp1","","Samples floating-point numbers according to the…",null,null],[3,"Beta","","The Beta distribution with shape parameters `alpha` and…",null,null],[3,"ChiSquared","","The chi-squared distribution `χ²(k)`, where `k` is the…",null,null],[3,"FisherF","","The Fisher F distribution `F(m, n)`.",null,null],[3,"Gamma","","The Gamma distribution `Gamma(shape, scale)` distribution.",null,null],[3,"StudentT","","The Student t distribution, `t(nu)`, where `nu` is the…",null,null],[3,"LogNormal","","The log-normal distribution `ln N(mean, std_dev**2)`.",null,null],[3,"Normal","","The normal distribution `N(mean, std_dev**2)`.",null,null],[3,"StandardNormal","","Samples floating-point numbers according to the normal…",null,null],[3,"Pareto","","Samples floating-point numbers according to the Pareto…",null,null],[3,"Poisson","","The Poisson distribution `Poisson(lambda)`.",null,null],[3,"Triangular","","The triangular distribution.",null,null],[3,"UnitCircle","","Samples uniformly from the edge of the unit circle in two…",null,null],[3,"UnitSphereSurface","","Samples uniformly from the surface of the unit sphere in…",null,null],[3,"Weibull","","Samples floating-point numbers according to the Weibull…",null,null],[3,"DistIter","","An iterator that generates random values of `T` with…",null,null],[3,"Standard","","A generic random value distribution, implemented for many…",null,null],[4,"BernoulliError","","Error type returned from `Bernoulli::new`.",null,null],[13,"InvalidProbability","","`p < 0` or `p > 1`.",2,null],[11,"new","","Construct a new `Bernoulli` with the given probability of…",3,[[["f64"]],[["result",["bernoulli","bernoullierror"]],["bernoulli"],["bernoullierror"]]]],[11,"from_ratio","","Construct a new `Bernoulli` with the probability of…",3,[[["u32"]],[["result",["bernoulli","bernoullierror"]],["bernoulli"],["bernoullierror"]]]],[11,"new","","Construct a new `Binomial` with the given shape parameters…",4,[[["f64"],["u64"]],["binomial"]]],[11,"new","","Construct a new `Cauchy` with the given shape parameters…",5,[[["f64"]],["cauchy"]]],[11,"new","","Construct a new `Dirichlet` with the given alpha parameter…",6,[[["into",["vec"]],["vec",["f64"]]],["dirichlet"]]],[11,"new_with_param","","Construct a new `Dirichlet` with the given shape parameter…",6,[[["f64"],["usize"]],["dirichlet"]]],[11,"new","","Construct a new `Exp` with the given shape parameter…",7,[[["f64"]],["exp"]]],[11,"new","","Construct an object representing the `Gamma(shape, scale)`…",8,[[["f64"]],["gamma"]]],[11,"new","","Create a new chi-squared distribution with…",9,[[["f64"]],["chisquared"]]],[11,"new","","Create a new `FisherF` distribution, with the given…",10,[[["f64"]],["fisherf"]]],[11,"new","","Create a new Student t distribution with `n` degrees of…",11,[[["f64"]],["studentt"]]],[11,"new","","Construct an object representing the `Beta(alpha, beta)`…",12,[[["f64"]],["beta"]]],[11,"new","","Construct a new `Normal` distribution with the given mean…",13,[[["f64"]],["normal"]]],[11,"new","","Construct a new `LogNormal` distribution with the given…",14,[[["f64"]],["lognormal"]]],[11,"new","","Construct a new Pareto distribution with given `scale` and…",15,[[["f64"]],["pareto"]]],[11,"new","","Construct a new `Poisson` with the given shape parameter…",16,[[["f64"]],["poisson"]]],[11,"new","","Construct a new `Triangular` with minimum `min`, maximum…",17,[[["f64"]],["triangular"]]],[0,"uniform","","A distribution uniformly sampling numbers within a given…",null,null],[3,"Uniform","rand::distributions::uniform","Sample values uniformly between two bounds.",null,null],[3,"UniformInt","","The back-end implementing [`UniformSampler`] for integer…",null,null],[3,"UniformFloat","","The back-end implementing [`UniformSampler`] for…",null,null],[3,"UniformDuration","","The back-end implementing [`UniformSampler`] for `Duration`.",null,null],[8,"SampleUniform","","Helper trait for creating objects using the correct…",null,null],[16,"Sampler","","The `UniformSampler` implementation supporting type `X`.",18,null],[8,"UniformSampler","","Helper trait handling actual uniform sampling.",null,null],[16,"X","","The type sampled by this implementation.",19,null],[10,"new","","Construct self, with inclusive lower bound and exclusive…",19,[[["b2"],["b1"]],["self"]]],[10,"new_inclusive","","Construct self, with inclusive bounds `[low, high]`.",19,[[["b2"],["b1"]],["self"]]],[10,"sample","","Sample a value.",19,[[["self"],["r"]]]],[11,"sample_single","","Sample a single value uniformly from a range with…",19,[[["b2"],["b1"],["r"]]]],[8,"SampleBorrow","","Helper trait similar to [`Borrow`] but implemented only…",null,null],[10,"borrow","","Immutably borrows from an owned value. See…",20,[[["self"]],["borrowed"]]],[11,"new","","Create a new `Uniform` instance which samples uniformly…",21,[[["b2"],["b1"]],["uniform"]]],[11,"new_inclusive","","Create a new `Uniform` instance which samples uniformly…",21,[[["b2"],["b1"]],["uniform"]]],[11,"new","rand::distributions","Construct a new `UnitCircle` distribution.",22,[[],["unitcircle"]]],[11,"new","","Construct a new `UnitSphereSurface` distribution.",23,[[],["unitspheresurface"]]],[11,"new","","Construct a new `Weibull` distribution with given `scale`…",24,[[["f64"]],["weibull"]]],[0,"weighted","","Weighted index sampling",null,null],[3,"WeightedIndex","rand::distributions::weighted","A distribution using weighted sampling to pick a…",null,null],[4,"WeightedError","","Error type returned from `WeightedIndex::new`.",null,null],[13,"NoItem","","The provided weight collection contains no items.",25,null],[13,"InvalidWeight","","A weight is either less than zero, greater than the…",25,null],[13,"AllWeightsZero","","All items in the provided weight collection are zero.",25,null],[13,"TooMany","","Too many weights are provided (length greater than…",25,null],[0,"alias_method","","This module contains an implementation of alias method for…",null,null],[3,"WeightedIndex","rand::distributions::weighted::alias_method","A distribution using weighted sampling to pick a…",null,null],[8,"Weight","","Trait that must be implemented for weights, that are used…",null,null],[18,"MAX","","Maximum number representable by `Self`.",26,null],[18,"ZERO","","Element of `Self` equivalent to 0.",26,null],[10,"try_from_u32_lossy","","Produce an instance of `Self` from a `u32` value, or…",26,[[["u32"]],["option"]]],[11,"sum","","Sums all values in slice `values`.",26,[[],["self"]]],[11,"new","","Creates a new [`WeightedIndex`].",27,[[["vec"]],[["weightederror"],["result",["weightederror"]]]]],[11,"new","rand::distributions::weighted","Creates a new a `WeightedIndex` [`Distribution`] using the…",28,[[["i"]],[["weightederror"],["weightedindex"],["result",["weightedindex","weightederror"]]]]],[11,"update_weights","","Update a subset of weights, without changing the number of…",28,[[["self"]],[["weightederror"],["result",["weightederror"]]]]],[8,"Distribution","rand::distributions","Types (distributions) that can be used to create a random…",null,null],[10,"sample","","Generate a random value of `T`, using `rng` as the source…",29,[[["self"],["r"]],["t"]]],[11,"sample_iter","","Create an iterator that generates random values of `T`,…",29,[[["r"]],["distiter"]]],[0,"prelude","rand","Convenience re-export of common members",null,null],[0,"rngs","","Random number generators and adapters",null,null],[3,"OsRng","rand::rngs","A random number generator that retrieves randomness from…",null,null],[3,"EntropyRng","","An interface returning random data from external…",null,null],[3,"StdRng","","The standard RNG. The PRNG algorithm in `StdRng` is chosen…",null,null],[3,"ThreadRng","","The type returned by [`thread_rng`], essentially just a…",null,null],[0,"adapter","","Wrappers / adapters forming RNGs",null,null],[3,"ReadError","rand::rngs::adapter","`ReadRng` error type",null,null],[3,"ReadRng","","An RNG that reads random bytes straight from any type…",null,null],[3,"ReseedingRng","","A wrapper around any PRNG that implements…",null,null],[11,"new","","Create a new `ReadRng` from a `Read`.",30,[[["r"]],["readrng"]]],[11,"new","","Create a new `ReseedingRng` from an existing PRNG,…",31,[[["rsdr"],["u64"],["r"]],["self"]]],[11,"reseed","","Reseed the internal PRNG.",31,[[["self"]],[["result",["error"]],["error"]]]],[11,"new","rand::rngs","Create a new `EntropyRng`.",32,[[],["self"]]],[0,"mock","","Mock random number generator",null,null],[3,"StepRng","rand::rngs::mock","A simple implementation of `RngCore` for testing purposes.",null,null],[11,"new","","Create a `StepRng`, yielding an arithmetic sequence…",33,[[["u64"]],["self"]]],[0,"seq","rand","Sequence-related functionality",null,null],[3,"SliceChooseIter","rand::seq","An iterator over multiple slice elements.",null,null],[0,"index","","Low-level API for sampling indices",null,null],[4,"IndexVec","rand::seq::index","A vector of indices.",null,null],[4,"IndexVecIter","","Return type of `IndexVec::iter`.",null,null],[4,"IndexVecIntoIter","","Return type of `IndexVec::into_iter`.",null,null],[5,"sample","","Randomly sample exactly `amount` distinct indices from…",null,[[["usize"],["r"]],["indexvec"]]],[11,"len","","Returns the number of indices",34,[[["self"]],["usize"]]],[11,"is_empty","","Returns `true` if the length is 0.",34,[[["self"]],["bool"]]],[11,"index","","Return the value at the given `index`.",34,[[["self"],["usize"]],["usize"]]],[11,"into_vec","","Return result as a `Vec`. Conversion may or may not…",34,[[],[["vec",["usize"]],["usize"]]]],[11,"iter","","Iterate over the indices as a sequence of `usize` values",34,[[["self"]],["indexveciter"]]],[11,"into_iter","","Convert into an iterator over the indices as a sequence of…",34,[[],["indexvecintoiter"]]],[8,"SliceRandom","rand::seq","Extension trait on slices, providing random mutation and…",null,null],[16,"Item","","The element type.",35,null],[10,"choose","","Returns a reference to one random element of the slice, or…",35,[[["self"],["r"]],["option"]]],[10,"choose_mut","","Returns a mutable reference to one random element of the…",35,[[["self"],["r"]],["option"]]],[10,"choose_multiple","","Chooses `amount` elements from the slice at random,…",35,[[["usize"],["self"],["r"]],["slicechooseiter"]]],[10,"choose_weighted","","Similar to [`choose`], but where the likelihood of each…",35,[[["f"],["self"],["r"]],[["result",["weightederror"]],["weightederror"]]]],[10,"choose_weighted_mut","","Similar to [`choose_mut`], but where the likelihood of…",35,[[["self"],["f"],["r"]],[["result",["weightederror"]],["weightederror"]]]],[10,"shuffle","","Shuffle a mutable slice in place.",35,[[["self"],["r"]]]],[10,"partial_shuffle","","Shuffle a slice in place, but exit early.",35,[[["self"],["usize"],["r"]]]],[8,"IteratorRandom","","Extension trait on iterators, providing random sampling…",null,null],[11,"choose","","Choose one element at random from the iterator.",36,[[["r"]],["option"]]],[11,"choose_multiple_fill","","Collects values at random from the iterator into a…",36,[[["r"]],["usize"]]],[11,"choose_multiple","","Collects `amount` values at random from the iterator into…",36,[[["usize"],["r"]],["vec"]]],[8,"Rng","rand","An automatically-implemented extension trait on…",null,null],[11,"gen","","Return a random value supporting the [`Standard`]…",37,[[["self"]],["t"]]],[11,"gen_range","","Generate a random value in the range [`low`, `high`), i.e.…",37,[[["b2"],["self"],["b1"]],["sampleuniform"]]],[11,"sample","","Sample a new value, using the given distribution.",37,[[["self"],["distribution"]],["t"]]],[11,"sample_iter","","Create an iterator that generates values using the given…",37,[[["d"]],["distiter"]]],[11,"fill","","Fill `dest` entirely with random bytes (uniform value…",37,[[["self"],["t"]]]],[11,"try_fill","","Fill `dest` entirely with random bytes (uniform value…",37,[[["self"],["t"]],[["result",["error"]],["error"]]]],[11,"gen_bool","","Return a bool with a probability `p` of being true.",37,[[["self"],["f64"]],["bool"]]],[11,"gen_ratio","","Return a bool with a probability of…",37,[[["self"],["u32"]],["bool"]]],[8,"AsByteSliceMut","","Trait for casting types to byte slices",null,null],[10,"as_byte_slice_mut","","Return a mutable reference to self as a byte slice",38,[[["self"]]]],[10,"to_le","","Call `to_le` on each element (i.e. byte-swap on Big Endian…",38,[[["self"]]]],[11,"from","","",39,[[["t"]],["t"]]],[11,"into","","",39,[[],["u"]]],[11,"to_string","","",39,[[["self"]],["string"]]],[11,"try_from","","",39,[[["u"]],["result"]]],[11,"try_into","","",39,[[],["result"]]],[11,"borrow","","",39,[[["self"]],["t"]]],[11,"borrow_mut","","",39,[[["self"]],["t"]]],[11,"type_id","","",39,[[["self"]],["typeid"]]],[11,"vzip","","",39,[[],["v"]]],[11,"from","rand::distributions","",3,[[["t"]],["t"]]],[11,"into","","",3,[[],["u"]]],[11,"to_owned","","",3,[[["self"]],["t"]]],[11,"clone_into","","",3,[[["self"],["t"]]]],[11,"try_from","","",3,[[["u"]],["result"]]],[11,"try_into","","",3,[[],["result"]]],[11,"borrow","","",3,[[["self"]],["t"]]],[11,"borrow_mut","","",3,[[["self"]],["t"]]],[11,"type_id","","",3,[[["self"]],["typeid"]]],[11,"vzip","","",3,[[],["v"]]],[11,"from","","",40,[[["t"]],["t"]]],[11,"into","","",40,[[],["u"]]],[11,"to_owned","","",40,[[["self"]],["t"]]],[11,"clone_into","","",40,[[["self"],["t"]]]],[11,"try_from","","",40,[[["u"]],["result"]]],[11,"try_into","","",40,[[],["result"]]],[11,"borrow","","",40,[[["self"]],["t"]]],[11,"borrow_mut","","",40,[[["self"]],["t"]]],[11,"type_id","","",40,[[["self"]],["typeid"]]],[11,"vzip","","",40,[[],["v"]]],[11,"from","","",41,[[["t"]],["t"]]],[11,"into","","",41,[[],["u"]]],[11,"to_owned","","",41,[[["self"]],["t"]]],[11,"clone_into","","",41,[[["self"],["t"]]]],[11,"try_from","","",41,[[["u"]],["result"]]],[11,"try_into","","",41,[[],["result"]]],[11,"borrow","","",41,[[["self"]],["t"]]],[11,"borrow_mut","","",41,[[["self"]],["t"]]],[11,"type_id","","",41,[[["self"]],["typeid"]]],[11,"vzip","","",41,[[],["v"]]],[11,"from","","",42,[[["t"]],["t"]]],[11,"into","","",42,[[],["u"]]],[11,"try_from","","",42,[[["u"]],["result"]]],[11,"try_into","","",42,[[],["result"]]],[11,"borrow","","",42,[[["self"]],["t"]]],[11,"borrow_mut","","",42,[[["self"]],["t"]]],[11,"type_id","","",42,[[["self"]],["typeid"]]],[11,"vzip","","",42,[[],["v"]]],[11,"from","rand::distributions::uniform","",21,[[["t"]],["t"]]],[11,"into","","",21,[[],["u"]]],[11,"to_owned","","",21,[[["self"]],["t"]]],[11,"clone_into","","",21,[[["self"],["t"]]]],[11,"try_from","","",21,[[["u"]],["result"]]],[11,"try_into","","",21,[[],["result"]]],[11,"borrow","","",21,[[["self"]],["t"]]],[11,"borrow_mut","","",21,[[["self"]],["t"]]],[11,"type_id","","",21,[[["self"]],["typeid"]]],[11,"vzip","","",21,[[],["v"]]],[11,"from","rand::distributions","",4,[[["t"]],["t"]]],[11,"into","","",4,[[],["u"]]],[11,"to_owned","","",4,[[["self"]],["t"]]],[11,"clone_into","","",4,[[["self"],["t"]]]],[11,"try_from","","",4,[[["u"]],["result"]]],[11,"try_into","","",4,[[],["result"]]],[11,"borrow","","",4,[[["self"]],["t"]]],[11,"borrow_mut","","",4,[[["self"]],["t"]]],[11,"type_id","","",4,[[["self"]],["typeid"]]],[11,"vzip","","",4,[[],["v"]]],[11,"from","","",5,[[["t"]],["t"]]],[11,"into","","",5,[[],["u"]]],[11,"to_owned","","",5,[[["self"]],["t"]]],[11,"clone_into","","",5,[[["self"],["t"]]]],[11,"try_from","","",5,[[["u"]],["result"]]],[11,"try_into","","",5,[[],["result"]]],[11,"borrow","","",5,[[["self"]],["t"]]],[11,"borrow_mut","","",5,[[["self"]],["t"]]],[11,"type_id","","",5,[[["self"]],["typeid"]]],[11,"vzip","","",5,[[],["v"]]],[11,"from","","",6,[[["t"]],["t"]]],[11,"into","","",6,[[],["u"]]],[11,"to_owned","","",6,[[["self"]],["t"]]],[11,"clone_into","","",6,[[["self"],["t"]]]],[11,"try_from","","",6,[[["u"]],["result"]]],[11,"try_into","","",6,[[],["result"]]],[11,"borrow","","",6,[[["self"]],["t"]]],[11,"borrow_mut","","",6,[[["self"]],["t"]]],[11,"type_id","","",6,[[["self"]],["typeid"]]],[11,"vzip","","",6,[[],["v"]]],[11,"from","","",7,[[["t"]],["t"]]],[11,"into","","",7,[[],["u"]]],[11,"to_owned","","",7,[[["self"]],["t"]]],[11,"clone_into","","",7,[[["self"],["t"]]]],[11,"try_from","","",7,[[["u"]],["result"]]],[11,"try_into","","",7,[[],["result"]]],[11,"borrow","","",7,[[["self"]],["t"]]],[11,"borrow_mut","","",7,[[["self"]],["t"]]],[11,"type_id","","",7,[[["self"]],["typeid"]]],[11,"vzip","","",7,[[],["v"]]],[11,"from","","",43,[[["t"]],["t"]]],[11,"into","","",43,[[],["u"]]],[11,"to_owned","","",43,[[["self"]],["t"]]],[11,"clone_into","","",43,[[["self"],["t"]]]],[11,"try_from","","",43,[[["u"]],["result"]]],[11,"try_into","","",43,[[],["result"]]],[11,"borrow","","",43,[[["self"]],["t"]]],[11,"borrow_mut","","",43,[[["self"]],["t"]]],[11,"type_id","","",43,[[["self"]],["typeid"]]],[11,"vzip","","",43,[[],["v"]]],[11,"from","","",12,[[["t"]],["t"]]],[11,"into","","",12,[[],["u"]]],[11,"to_owned","","",12,[[["self"]],["t"]]],[11,"clone_into","","",12,[[["self"],["t"]]]],[11,"try_from","","",12,[[["u"]],["result"]]],[11,"try_into","","",12,[[],["result"]]],[11,"borrow","","",12,[[["self"]],["t"]]],[11,"borrow_mut","","",12,[[["self"]],["t"]]],[11,"type_id","","",12,[[["self"]],["typeid"]]],[11,"vzip","","",12,[[],["v"]]],[11,"from","","",9,[[["t"]],["t"]]],[11,"into","","",9,[[],["u"]]],[11,"to_owned","","",9,[[["self"]],["t"]]],[11,"clone_into","","",9,[[["self"],["t"]]]],[11,"try_from","","",9,[[["u"]],["result"]]],[11,"try_into","","",9,[[],["result"]]],[11,"borrow","","",9,[[["self"]],["t"]]],[11,"borrow_mut","","",9,[[["self"]],["t"]]],[11,"type_id","","",9,[[["self"]],["typeid"]]],[11,"vzip","","",9,[[],["v"]]],[11,"from","","",10,[[["t"]],["t"]]],[11,"into","","",10,[[],["u"]]],[11,"to_owned","","",10,[[["self"]],["t"]]],[11,"clone_into","","",10,[[["self"],["t"]]]],[11,"try_from","","",10,[[["u"]],["result"]]],[11,"try_into","","",10,[[],["result"]]],[11,"borrow","","",10,[[["self"]],["t"]]],[11,"borrow_mut","","",10,[[["self"]],["t"]]],[11,"type_id","","",10,[[["self"]],["typeid"]]],[11,"vzip","","",10,[[],["v"]]],[11,"from","","",8,[[["t"]],["t"]]],[11,"into","","",8,[[],["u"]]],[11,"to_owned","","",8,[[["self"]],["t"]]],[11,"clone_into","","",8,[[["self"],["t"]]]],[11,"try_from","","",8,[[["u"]],["result"]]],[11,"try_into","","",8,[[],["result"]]],[11,"borrow","","",8,[[["self"]],["t"]]],[11,"borrow_mut","","",8,[[["self"]],["t"]]],[11,"type_id","","",8,[[["self"]],["typeid"]]],[11,"vzip","","",8,[[],["v"]]],[11,"from","","",11,[[["t"]],["t"]]],[11,"into","","",11,[[],["u"]]],[11,"to_owned","","",11,[[["self"]],["t"]]],[11,"clone_into","","",11,[[["self"],["t"]]]],[11,"try_from","","",11,[[["u"]],["result"]]],[11,"try_into","","",11,[[],["result"]]],[11,"borrow","","",11,[[["self"]],["t"]]],[11,"borrow_mut","","",11,[[["self"]],["t"]]],[11,"type_id","","",11,[[["self"]],["typeid"]]],[11,"vzip","","",11,[[],["v"]]],[11,"from","","",14,[[["t"]],["t"]]],[11,"into","","",14,[[],["u"]]],[11,"to_owned","","",14,[[["self"]],["t"]]],[11,"clone_into","","",14,[[["self"],["t"]]]],[11,"try_from","","",14,[[["u"]],["result"]]],[11,"try_into","","",14,[[],["result"]]],[11,"borrow","","",14,[[["self"]],["t"]]],[11,"borrow_mut","","",14,[[["self"]],["t"]]],[11,"type_id","","",14,[[["self"]],["typeid"]]],[11,"vzip","","",14,[[],["v"]]],[11,"from","","",13,[[["t"]],["t"]]],[11,"into","","",13,[[],["u"]]],[11,"to_owned","","",13,[[["self"]],["t"]]],[11,"clone_into","","",13,[[["self"],["t"]]]],[11,"try_from","","",13,[[["u"]],["result"]]],[11,"try_into","","",13,[[],["result"]]],[11,"borrow","","",13,[[["self"]],["t"]]],[11,"borrow_mut","","",13,[[["self"]],["t"]]],[11,"type_id","","",13,[[["self"]],["typeid"]]],[11,"vzip","","",13,[[],["v"]]],[11,"from","","",44,[[["t"]],["t"]]],[11,"into","","",44,[[],["u"]]],[11,"to_owned","","",44,[[["self"]],["t"]]],[11,"clone_into","","",44,[[["self"],["t"]]]],[11,"try_from","","",44,[[["u"]],["result"]]],[11,"try_into","","",44,[[],["result"]]],[11,"borrow","","",44,[[["self"]],["t"]]],[11,"borrow_mut","","",44,[[["self"]],["t"]]],[11,"type_id","","",44,[[["self"]],["typeid"]]],[11,"vzip","","",44,[[],["v"]]],[11,"from","","",15,[[["t"]],["t"]]],[11,"into","","",15,[[],["u"]]],[11,"to_owned","","",15,[[["self"]],["t"]]],[11,"clone_into","","",15,[[["self"],["t"]]]],[11,"try_from","","",15,[[["u"]],["result"]]],[11,"try_into","","",15,[[],["result"]]],[11,"borrow","","",15,[[["self"]],["t"]]],[11,"borrow_mut","","",15,[[["self"]],["t"]]],[11,"type_id","","",15,[[["self"]],["typeid"]]],[11,"vzip","","",15,[[],["v"]]],[11,"from","","",16,[[["t"]],["t"]]],[11,"into","","",16,[[],["u"]]],[11,"to_owned","","",16,[[["self"]],["t"]]],[11,"clone_into","","",16,[[["self"],["t"]]]],[11,"try_from","","",16,[[["u"]],["result"]]],[11,"try_into","","",16,[[],["result"]]],[11,"borrow","","",16,[[["self"]],["t"]]],[11,"borrow_mut","","",16,[[["self"]],["t"]]],[11,"type_id","","",16,[[["self"]],["typeid"]]],[11,"vzip","","",16,[[],["v"]]],[11,"from","","",17,[[["t"]],["t"]]],[11,"into","","",17,[[],["u"]]],[11,"to_owned","","",17,[[["self"]],["t"]]],[11,"clone_into","","",17,[[["self"],["t"]]]],[11,"try_from","","",17,[[["u"]],["result"]]],[11,"try_into","","",17,[[],["result"]]],[11,"borrow","","",17,[[["self"]],["t"]]],[11,"borrow_mut","","",17,[[["self"]],["t"]]],[11,"type_id","","",17,[[["self"]],["typeid"]]],[11,"vzip","","",17,[[],["v"]]],[11,"from","","",22,[[["t"]],["t"]]],[11,"into","","",22,[[],["u"]]],[11,"to_owned","","",22,[[["self"]],["t"]]],[11,"clone_into","","",22,[[["self"],["t"]]]],[11,"try_from","","",22,[[["u"]],["result"]]],[11,"try_into","","",22,[[],["result"]]],[11,"borrow","","",22,[[["self"]],["t"]]],[11,"borrow_mut","","",22,[[["self"]],["t"]]],[11,"type_id","","",22,[[["self"]],["typeid"]]],[11,"vzip","","",22,[[],["v"]]],[11,"from","","",23,[[["t"]],["t"]]],[11,"into","","",23,[[],["u"]]],[11,"to_owned","","",23,[[["self"]],["t"]]],[11,"clone_into","","",23,[[["self"],["t"]]]],[11,"try_from","","",23,[[["u"]],["result"]]],[11,"try_into","","",23,[[],["result"]]],[11,"borrow","","",23,[[["self"]],["t"]]],[11,"borrow_mut","","",23,[[["self"]],["t"]]],[11,"type_id","","",23,[[["self"]],["typeid"]]],[11,"vzip","","",23,[[],["v"]]],[11,"from","","",24,[[["t"]],["t"]]],[11,"into","","",24,[[],["u"]]],[11,"to_owned","","",24,[[["self"]],["t"]]],[11,"clone_into","","",24,[[["self"],["t"]]]],[11,"try_from","","",24,[[["u"]],["result"]]],[11,"try_into","","",24,[[],["result"]]],[11,"borrow","","",24,[[["self"]],["t"]]],[11,"borrow_mut","","",24,[[["self"]],["t"]]],[11,"type_id","","",24,[[["self"]],["typeid"]]],[11,"vzip","","",24,[[],["v"]]],[11,"from","","",45,[[["t"]],["t"]]],[11,"into","","",45,[[],["u"]]],[11,"into_iter","","",45,[[],["i"]]],[11,"try_from","","",45,[[["u"]],["result"]]],[11,"try_into","","",45,[[],["result"]]],[11,"borrow","","",45,[[["self"]],["t"]]],[11,"borrow_mut","","",45,[[["self"]],["t"]]],[11,"type_id","","",45,[[["self"]],["typeid"]]],[11,"vzip","","",45,[[],["v"]]],[11,"from","","",46,[[["t"]],["t"]]],[11,"into","","",46,[[],["u"]]],[11,"to_owned","","",46,[[["self"]],["t"]]],[11,"clone_into","","",46,[[["self"],["t"]]]],[11,"try_from","","",46,[[["u"]],["result"]]],[11,"try_into","","",46,[[],["result"]]],[11,"borrow","","",46,[[["self"]],["t"]]],[11,"borrow_mut","","",46,[[["self"]],["t"]]],[11,"type_id","","",46,[[["self"]],["typeid"]]],[11,"vzip","","",46,[[],["v"]]],[11,"from","","",2,[[["t"]],["t"]]],[11,"into","","",2,[[],["u"]]],[11,"to_owned","","",2,[[["self"]],["t"]]],[11,"clone_into","","",2,[[["self"],["t"]]]],[11,"to_string","","",2,[[["self"]],["string"]]],[11,"try_from","","",2,[[["u"]],["result"]]],[11,"try_into","","",2,[[],["result"]]],[11,"borrow","","",2,[[["self"]],["t"]]],[11,"borrow_mut","","",2,[[["self"]],["t"]]],[11,"type_id","","",2,[[["self"]],["typeid"]]],[11,"vzip","","",2,[[],["v"]]],[11,"from","rand::distributions::uniform","",47,[[["t"]],["t"]]],[11,"into","","",47,[[],["u"]]],[11,"to_owned","","",47,[[["self"]],["t"]]],[11,"clone_into","","",47,[[["self"],["t"]]]],[11,"try_from","","",47,[[["u"]],["result"]]],[11,"try_into","","",47,[[],["result"]]],[11,"borrow","","",47,[[["self"]],["t"]]],[11,"borrow_mut","","",47,[[["self"]],["t"]]],[11,"type_id","","",47,[[["self"]],["typeid"]]],[11,"vzip","","",47,[[],["v"]]],[11,"from","","",48,[[["t"]],["t"]]],[11,"into","","",48,[[],["u"]]],[11,"to_owned","","",48,[[["self"]],["t"]]],[11,"clone_into","","",48,[[["self"],["t"]]]],[11,"try_from","","",48,[[["u"]],["result"]]],[11,"try_into","","",48,[[],["result"]]],[11,"borrow","","",48,[[["self"]],["t"]]],[11,"borrow_mut","","",48,[[["self"]],["t"]]],[11,"type_id","","",48,[[["self"]],["typeid"]]],[11,"vzip","","",48,[[],["v"]]],[11,"from","","",49,[[["t"]],["t"]]],[11,"into","","",49,[[],["u"]]],[11,"to_owned","","",49,[[["self"]],["t"]]],[11,"clone_into","","",49,[[["self"],["t"]]]],[11,"try_from","","",49,[[["u"]],["result"]]],[11,"try_into","","",49,[[],["result"]]],[11,"borrow","","",49,[[["self"]],["t"]]],[11,"borrow_mut","","",49,[[["self"]],["t"]]],[11,"type_id","","",49,[[["self"]],["typeid"]]],[11,"vzip","","",49,[[],["v"]]],[11,"from","rand::distributions::weighted","",28,[[["t"]],["t"]]],[11,"into","","",28,[[],["u"]]],[11,"to_owned","","",28,[[["self"]],["t"]]],[11,"clone_into","","",28,[[["self"],["t"]]]],[11,"try_from","","",28,[[["u"]],["result"]]],[11,"try_into","","",28,[[],["result"]]],[11,"borrow","","",28,[[["self"]],["t"]]],[11,"borrow_mut","","",28,[[["self"]],["t"]]],[11,"type_id","","",28,[[["self"]],["typeid"]]],[11,"vzip","","",28,[[],["v"]]],[11,"from","","",25,[[["t"]],["t"]]],[11,"into","","",25,[[],["u"]]],[11,"to_owned","","",25,[[["self"]],["t"]]],[11,"clone_into","","",25,[[["self"],["t"]]]],[11,"to_string","","",25,[[["self"]],["string"]]],[11,"try_from","","",25,[[["u"]],["result"]]],[11,"try_into","","",25,[[],["result"]]],[11,"borrow","","",25,[[["self"]],["t"]]],[11,"borrow_mut","","",25,[[["self"]],["t"]]],[11,"type_id","","",25,[[["self"]],["typeid"]]],[11,"vzip","","",25,[[],["v"]]],[11,"from","rand::distributions::weighted::alias_method","",27,[[["t"]],["t"]]],[11,"into","","",27,[[],["u"]]],[11,"to_owned","","",27,[[["self"]],["t"]]],[11,"clone_into","","",27,[[["self"],["t"]]]],[11,"try_from","","",27,[[["u"]],["result"]]],[11,"try_into","","",27,[[],["result"]]],[11,"borrow","","",27,[[["self"]],["t"]]],[11,"borrow_mut","","",27,[[["self"]],["t"]]],[11,"type_id","","",27,[[["self"]],["typeid"]]],[11,"vzip","","",27,[[],["v"]]],[11,"from","rand::rngs","",50,[[["t"]],["t"]]],[11,"into","","",50,[[],["u"]]],[11,"to_owned","","",50,[[["self"]],["t"]]],[11,"clone_into","","",50,[[["self"],["t"]]]],[11,"try_from","","",50,[[["u"]],["result"]]],[11,"try_into","","",50,[[],["result"]]],[11,"borrow","","",50,[[["self"]],["t"]]],[11,"borrow_mut","","",50,[[["self"]],["t"]]],[11,"type_id","","",50,[[["self"]],["typeid"]]],[11,"vzip","","",50,[[],["v"]]],[11,"from","","",32,[[["t"]],["t"]]],[11,"into","","",32,[[],["u"]]],[11,"try_from","","",32,[[["u"]],["result"]]],[11,"try_into","","",32,[[],["result"]]],[11,"borrow","","",32,[[["self"]],["t"]]],[11,"borrow_mut","","",32,[[["self"]],["t"]]],[11,"type_id","","",32,[[["self"]],["typeid"]]],[11,"vzip","","",32,[[],["v"]]],[11,"from","","",51,[[["t"]],["t"]]],[11,"into","","",51,[[],["u"]]],[11,"to_owned","","",51,[[["self"]],["t"]]],[11,"clone_into","","",51,[[["self"],["t"]]]],[11,"try_from","","",51,[[["u"]],["result"]]],[11,"try_into","","",51,[[],["result"]]],[11,"borrow","","",51,[[["self"]],["t"]]],[11,"borrow_mut","","",51,[[["self"]],["t"]]],[11,"type_id","","",51,[[["self"]],["typeid"]]],[11,"vzip","","",51,[[],["v"]]],[11,"from","","",52,[[["t"]],["t"]]],[11,"into","","",52,[[],["u"]]],[11,"to_owned","","",52,[[["self"]],["t"]]],[11,"clone_into","","",52,[[["self"],["t"]]]],[11,"try_from","","",52,[[["u"]],["result"]]],[11,"try_into","","",52,[[],["result"]]],[11,"borrow","","",52,[[["self"]],["t"]]],[11,"borrow_mut","","",52,[[["self"]],["t"]]],[11,"type_id","","",52,[[["self"]],["typeid"]]],[11,"vzip","","",52,[[],["v"]]],[11,"from","rand::rngs::adapter","",53,[[["t"]],["t"]]],[11,"into","","",53,[[],["u"]]],[11,"to_string","","",53,[[["self"]],["string"]]],[11,"try_from","","",53,[[["u"]],["result"]]],[11,"try_into","","",53,[[],["result"]]],[11,"borrow","","",53,[[["self"]],["t"]]],[11,"borrow_mut","","",53,[[["self"]],["t"]]],[11,"type_id","","",53,[[["self"]],["typeid"]]],[11,"vzip","","",53,[[],["v"]]],[11,"from","","",30,[[["t"]],["t"]]],[11,"into","","",30,[[],["u"]]],[11,"try_from","","",30,[[["u"]],["result"]]],[11,"try_into","","",30,[[],["result"]]],[11,"borrow","","",30,[[["self"]],["t"]]],[11,"borrow_mut","","",30,[[["self"]],["t"]]],[11,"type_id","","",30,[[["self"]],["typeid"]]],[11,"vzip","","",30,[[],["v"]]],[11,"from","","",31,[[["t"]],["t"]]],[11,"into","","",31,[[],["u"]]],[11,"to_owned","","",31,[[["self"]],["t"]]],[11,"clone_into","","",31,[[["self"],["t"]]]],[11,"try_from","","",31,[[["u"]],["result"]]],[11,"try_into","","",31,[[],["result"]]],[11,"borrow","","",31,[[["self"]],["t"]]],[11,"borrow_mut","","",31,[[["self"]],["t"]]],[11,"type_id","","",31,[[["self"]],["typeid"]]],[11,"vzip","","",31,[[],["v"]]],[11,"from","rand::rngs::mock","",33,[[["t"]],["t"]]],[11,"into","","",33,[[],["u"]]],[11,"to_owned","","",33,[[["self"]],["t"]]],[11,"clone_into","","",33,[[["self"],["t"]]]],[11,"try_from","","",33,[[["u"]],["result"]]],[11,"try_into","","",33,[[],["result"]]],[11,"borrow","","",33,[[["self"]],["t"]]],[11,"borrow_mut","","",33,[[["self"]],["t"]]],[11,"type_id","","",33,[[["self"]],["typeid"]]],[11,"vzip","","",33,[[],["v"]]],[11,"from","rand::seq","",54,[[["t"]],["t"]]],[11,"into","","",54,[[],["u"]]],[11,"into_iter","","",54,[[],["i"]]],[11,"try_from","","",54,[[["u"]],["result"]]],[11,"try_into","","",54,[[],["result"]]],[11,"borrow","","",54,[[["self"]],["t"]]],[11,"borrow_mut","","",54,[[["self"]],["t"]]],[11,"type_id","","",54,[[["self"]],["typeid"]]],[11,"vzip","","",54,[[],["v"]]],[11,"from","rand::seq::index","",34,[[["t"]],["t"]]],[11,"into","","",34,[[],["u"]]],[11,"to_owned","","",34,[[["self"]],["t"]]],[11,"clone_into","","",34,[[["self"],["t"]]]],[11,"try_from","","",34,[[["u"]],["result"]]],[11,"try_into","","",34,[[],["result"]]],[11,"borrow","","",34,[[["self"]],["t"]]],[11,"borrow_mut","","",34,[[["self"]],["t"]]],[11,"type_id","","",34,[[["self"]],["typeid"]]],[11,"vzip","","",34,[[],["v"]]],[11,"from","","",55,[[["t"]],["t"]]],[11,"into","","",55,[[],["u"]]],[11,"into_iter","","",55,[[],["i"]]],[11,"try_from","","",55,[[["u"]],["result"]]],[11,"try_into","","",55,[[],["result"]]],[11,"borrow","","",55,[[["self"]],["t"]]],[11,"borrow_mut","","",55,[[["self"]],["t"]]],[11,"type_id","","",55,[[["self"]],["typeid"]]],[11,"vzip","","",55,[[],["v"]]],[11,"from","","",56,[[["t"]],["t"]]],[11,"into","","",56,[[],["u"]]],[11,"into_iter","","",56,[[],["i"]]],[11,"to_owned","","",56,[[["self"]],["t"]]],[11,"clone_into","","",56,[[["self"],["t"]]]],[11,"try_from","","",56,[[["u"]],["result"]]],[11,"try_into","","",56,[[],["result"]]],[11,"borrow","","",56,[[["self"]],["t"]]],[11,"borrow_mut","","",56,[[["self"]],["t"]]],[11,"type_id","","",56,[[["self"]],["typeid"]]],[11,"vzip","","",56,[[],["v"]]],[11,"fmt","rand::rngs","",50,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"fmt","rand","",39,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"next_u32","rand::rngs","",50,[[["self"]],["u32"]]],[11,"next_u64","","",50,[[["self"]],["u64"]]],[11,"fill_bytes","","",50,[[["self"]]]],[11,"try_fill_bytes","","",50,[[["self"]],[["error"],["result",["error"]]]]],[11,"read","rand","",0,[[["self"]],[["error"],["result",["usize","error"]],["usize"]]]],[11,"fmt","","",39,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"from","","",39,[[["nonzerou32"]],["error"]]],[11,"from","","",39,[[["error"]],["error"]]],[11,"default","rand::rngs","",50,[[],["osrng"]]],[11,"source","rand","",39,[[["self"]],[["option",["error"]],["error"]]]],[11,"clone","rand::rngs","",50,[[["self"]],["osrng"]]],[11,"new","rand::distributions::uniform","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",47,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",47,[[["b2"],["b1"]],["self"]]],[11,"sample","","",47,[[["self"],["r"]]]],[11,"sample_single","","",47,[[["b2"],["b1"],["r"]]]],[11,"new","","",48,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",48,[[["b2"],["b1"]],["self"]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample_single","","",48,[[["b2"],["b1"],["r"]]]],[11,"new","","",48,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",48,[[["b2"],["b1"]],["self"]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample_single","","",48,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]],["duration"]]],[11,"sample","rand::distributions","",3,[[["self"],["r"]],["bool"]]],[11,"sample","","",4,[[["self"],["r"]],["u64"]]],[11,"sample","","",5,[[["self"],["r"]],["f64"]]],[11,"sample","","",6,[[["self"],["r"]],[["f64"],["vec",["f64"]]]]],[11,"sample","","",43,[[["self"],["r"]],["f64"]]],[11,"sample","","",7,[[["self"],["r"]],["f64"]]],[11,"sample","","",8,[[["self"],["r"]],["f64"]]],[11,"sample","","",9,[[["self"],["r"]],["f64"]]],[11,"sample","","",10,[[["self"],["r"]],["f64"]]],[11,"sample","","",11,[[["self"],["r"]],["f64"]]],[11,"sample","","",12,[[["self"],["r"]],["f64"]]],[11,"sample","","",44,[[["self"],["r"]],["f64"]]],[11,"sample","","",13,[[["self"],["r"]],["f64"]]],[11,"sample","","",14,[[["self"],["r"]],["f64"]]],[11,"sample","","",15,[[["self"],["r"]],["f64"]]],[11,"sample","","",16,[[["self"],["r"]],["u64"]]],[11,"sample","","",17,[[["self"],["r"]],["f64"]]],[11,"sample","rand::distributions::uniform","",21,[[["self"],["r"]],["x"]]],[11,"sample","rand::distributions","",22,[[["self"],["r"]]]],[11,"sample","","",23,[[["self"],["r"]]]],[11,"sample","","",24,[[["self"],["r"]],["f64"]]],[11,"sample","rand::distributions::weighted::alias_method","",27,[[["self"],["r"]],["usize"]]],[11,"sample","rand::distributions::weighted","",28,[[["self"],["r"]],["usize"]]],[11,"sample","rand::distributions","",46,[[["self"],["r"]],["f32"]]],[11,"sample","","",41,[[["self"],["r"]],["f32"]]],[11,"sample","","",40,[[["self"],["r"]],["f32"]]],[11,"sample","","",46,[[["self"],["r"]],["f64"]]],[11,"sample","","",41,[[["self"],["r"]],["f64"]]],[11,"sample","","",40,[[["self"],["r"]],["f64"]]],[11,"sample","","",46,[[["self"],["r"]],["u8"]]],[11,"sample","","",46,[[["self"],["r"]],["u16"]]],[11,"sample","","",46,[[["self"],["r"]],["u32"]]],[11,"sample","","",46,[[["self"],["r"]],["u64"]]],[11,"sample","","",46,[[["self"],["r"]],["u128"]]],[11,"sample","","",46,[[["self"],["r"]],["usize"]]],[11,"sample","","",46,[[["self"],["r"]],["i8"]]],[11,"sample","","",46,[[["self"],["r"]],["i16"]]],[11,"sample","","",46,[[["self"],["r"]],["i32"]]],[11,"sample","","",46,[[["self"],["r"]],["i64"]]],[11,"sample","","",46,[[["self"],["r"]],["i128"]]],[11,"sample","","",46,[[["self"],["r"]],["isize"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerou8"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerou16"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerou32"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerou64"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerou128"]]],[11,"sample","","",46,[[["self"],["r"]],["nonzerousize"]]],[11,"sample","","",46,[[["self"],["r"]],["char"]]],[11,"sample","","",42,[[["self"],["r"]],["char"]]],[11,"sample","","",46,[[["self"],["r"]],["bool"]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]]]],[11,"sample","","",46,[[["self"],["r"]],["option"]]],[11,"sample","","",46,[[["self"],["r"]],["wrapping"]]],[11,"from","rand::distributions::uniform","",21,[[["range"]],["uniform"]]],[11,"from","","",21,[[["rangeinclusive"]],["uniform"]]],[11,"from","rand::seq::index","",34,[[["u32"],["vec",["u32"]]],["self"]]],[11,"from","","",34,[[["vec",["usize"]],["usize"]],["self"]]],[11,"len","rand::seq","",54,[[["self"]],["usize"]]],[11,"next","rand::distributions","",45,[[["self"]],["option"]]],[11,"size_hint","","",45,[[["self"]]]],[11,"next","rand::seq::index","",55,[[["self"]],[["usize"],["option",["usize"]]]]],[11,"size_hint","","",55,[[["self"]]]],[11,"next","","",56,[[["self"]],["option"]]],[11,"size_hint","","",56,[[["self"]]]],[11,"next","rand::seq","",54,[[["self"]],["option"]]],[11,"size_hint","","",54,[[["self"]]]],[11,"clone","rand::distributions","",3,[[["self"]],["bernoulli"]]],[11,"clone","","",2,[[["self"]],["bernoullierror"]]],[11,"clone","","",4,[[["self"]],["binomial"]]],[11,"clone","","",5,[[["self"]],["cauchy"]]],[11,"clone","","",6,[[["self"]],["dirichlet"]]],[11,"clone","","",43,[[["self"]],["exp1"]]],[11,"clone","","",7,[[["self"]],["exp"]]],[11,"clone","","",8,[[["self"]],["gamma"]]],[11,"clone","","",9,[[["self"]],["chisquared"]]],[11,"clone","","",10,[[["self"]],["fisherf"]]],[11,"clone","","",11,[[["self"]],["studentt"]]],[11,"clone","","",12,[[["self"]],["beta"]]],[11,"clone","","",44,[[["self"]],["standardnormal"]]],[11,"clone","","",13,[[["self"]],["normal"]]],[11,"clone","","",14,[[["self"]],["lognormal"]]],[11,"clone","","",15,[[["self"]],["pareto"]]],[11,"clone","","",16,[[["self"]],["poisson"]]],[11,"clone","","",17,[[["self"]],["triangular"]]],[11,"clone","rand::distributions::uniform","",21,[[["self"]],["uniform"]]],[11,"clone","","",47,[[["self"]],["uniformint"]]],[11,"clone","","",48,[[["self"]],["uniformfloat"]]],[11,"clone","","",49,[[["self"]],["uniformduration"]]],[11,"clone","rand::distributions","",22,[[["self"]],["unitcircle"]]],[11,"clone","","",23,[[["self"]],["unitspheresurface"]]],[11,"clone","","",24,[[["self"]],["weibull"]]],[11,"clone","rand::distributions::weighted::alias_method","",27,[[["self"]],["self"]]],[11,"clone","rand::distributions::weighted","",28,[[["self"]],["weightedindex"]]],[11,"clone","","",25,[[["self"]],["weightederror"]]],[11,"clone","rand::distributions","",41,[[["self"]],["openclosed01"]]],[11,"clone","","",40,[[["self"]],["open01"]]],[11,"clone","","",46,[[["self"]],["standard"]]],[11,"clone","rand::rngs::adapter","",31,[[["self"]],["reseedingrng"]]],[11,"clone","rand::rngs::mock","",33,[[["self"]],["steprng"]]],[11,"clone","rand::rngs","",51,[[["self"]],["stdrng"]]],[11,"clone","","",52,[[["self"]],["threadrng"]]],[11,"clone","rand::seq::index","",34,[[["self"]],["indexvec"]]],[11,"clone","","",56,[[["self"]],["indexvecintoiter"]]],[11,"default","rand::rngs","",32,[[],["self"]]],[11,"default","","",52,[[],["threadrng"]]],[11,"eq","rand::distributions","",2,[[["bernoullierror"],["self"]],["bool"]]],[11,"eq","rand::distributions::weighted","",25,[[["self"],["weightederror"]],["bool"]]],[11,"eq","rand::seq::index","",34,[[["self"],["indexvec"]],["bool"]]],[11,"fmt","rand::distributions","",3,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",2,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",4,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",5,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",6,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",43,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",7,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",8,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",9,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",10,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",11,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",12,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",44,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",13,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",14,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",15,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",16,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",17,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions::uniform","",21,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",47,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",48,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",49,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions","",22,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",23,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",24,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions::weighted::alias_method","",27,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions::weighted","",28,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",25,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions","",41,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",40,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",42,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",45,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",46,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs::adapter","",30,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",53,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",31,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs","",32,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs::mock","",33,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs","",51,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",52,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::seq::index","",34,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",55,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",56,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::seq","",54,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions","",2,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions::weighted","",25,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs::adapter","",53,[[["formatter"],["self"]],["result"]]],[11,"source","","",53,[[["self"]],[["error"],["option",["error"]]]]],[11,"next_u32","","",30,[[["self"]],["u32"]]],[11,"next_u64","","",30,[[["self"]],["u64"]]],[11,"fill_bytes","","",30,[[["self"]]]],[11,"try_fill_bytes","","",30,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",31,[[["self"]],["u32"]]],[11,"next_u64","","",31,[[["self"]],["u64"]]],[11,"fill_bytes","","",31,[[["self"]]]],[11,"try_fill_bytes","","",31,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs","",32,[[["self"]],["u32"]]],[11,"next_u64","","",32,[[["self"]],["u64"]]],[11,"fill_bytes","","",32,[[["self"]]]],[11,"try_fill_bytes","","",32,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs::mock","",33,[[["self"]],["u32"]]],[11,"next_u64","","",33,[[["self"]],["u64"]]],[11,"fill_bytes","","",33,[[["self"]]]],[11,"try_fill_bytes","","",33,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs","",51,[[["self"]],["u32"]]],[11,"next_u64","","",51,[[["self"]],["u64"]]],[11,"fill_bytes","","",51,[[["self"]]]],[11,"try_fill_bytes","","",51,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",52,[[["self"]],["u32"]]],[11,"next_u64","","",52,[[["self"]],["u64"]]],[11,"fill_bytes","","",52,[[["self"]]]],[11,"try_fill_bytes","","",52,[[["self"]],[["result",["error"]],["error"]]]],[11,"from_seed","","",51,[[],["self"]]],[11,"from_rng","","",51,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"new","rand","Construct from any type supporting `std::error::Error`",39,[[["e"]],["error"]]],[11,"inner","","Reference the inner error (`std` only)",39,[[["self"]],["error"]]],[11,"take_inner","","Unwrap the inner error (`std` only)",39,[[],[["box",["error"]],["error"]]]],[18,"INTERNAL_START","","Codes below this point represent OS Errors (i.e. positive…",39,null],[18,"CUSTOM_START","","Codes at or above this point can be used by users to…",39,null],[11,"raw_os_error","","Extract the raw OS error code (if this error came from the…",39,[[["self"]],[["option",["i32"]],["i32"]]]],[11,"code","","Retrieve the error code, if any.",39,[[["self"]],[["option",["nonzerou32"]],["nonzerou32"]]]]],"p":[[8,"RngCore"],[8,"SeedableRng"],[4,"BernoulliError"],[3,"Bernoulli"],[3,"Binomial"],[3,"Cauchy"],[3,"Dirichlet"],[3,"Exp"],[3,"Gamma"],[3,"ChiSquared"],[3,"FisherF"],[3,"StudentT"],[3,"Beta"],[3,"Normal"],[3,"LogNormal"],[3,"Pareto"],[3,"Poisson"],[3,"Triangular"],[8,"SampleUniform"],[8,"UniformSampler"],[8,"SampleBorrow"],[3,"Uniform"],[3,"UnitCircle"],[3,"UnitSphereSurface"],[3,"Weibull"],[4,"WeightedError"],[8,"Weight"],[3,"WeightedIndex"],[3,"WeightedIndex"],[8,"Distribution"],[3,"ReadRng"],[3,"ReseedingRng"],[3,"EntropyRng"],[3,"StepRng"],[4,"IndexVec"],[8,"SliceRandom"],[8,"IteratorRandom"],[8,"Rng"],[8,"AsByteSliceMut"],[3,"Error"],[3,"Open01"],[3,"OpenClosed01"],[3,"Alphanumeric"],[3,"Exp1"],[3,"StandardNormal"],[3,"DistIter"],[3,"Standard"],[3,"UniformInt"],[3,"UniformFloat"],[3,"UniformDuration"],[3,"OsRng"],[3,"StdRng"],[3,"ThreadRng"],[3,"ReadError"],[3,"SliceChooseIter"],[4,"IndexVecIter"],[4,"IndexVecIntoIter"]]}; +searchIndex["rand"] = {"doc":"Utilities for random number generation","i":[[8,"RngCore","rand","The core of a random number generator.",null,null],[10,"next_u32","","Return the next random `u32`.",0,[[["self"]],["u32"]]],[10,"next_u64","","Return the next random `u64`.",0,[[["self"]],["u64"]]],[10,"fill_bytes","","Fill `dest` with random data.",0,[[["self"]]]],[10,"try_fill_bytes","","Fill `dest` entirely with random data.",0,[[["self"]],[["result",["error"]],["error"]]]],[8,"CryptoRng","","A marker trait used to indicate that an [`RngCore`] or…",null,null],[8,"SeedableRng","","A random number generator that can be explicitly seeded.",null,null],[16,"Seed","","Seed type, which is restricted to types…",1,null],[10,"from_seed","","Create a new PRNG using the given seed.",1,[[],["self"]]],[11,"seed_from_u64","","Create a new PRNG using a `u64` seed.",1,[[["u64"]],["self"]]],[11,"from_rng","","Create a new PRNG seeded from another `Rng`.",1,[[["r"]],[["error"],["result",["error"]]]]],[4,"ErrorKind","","Error kind which can be matched over.",null,null],[13,"Unavailable","","Feature is not available; not recoverable.",2,null],[13,"Unexpected","","General failure; there may be a chance of recovery on retry.",2,null],[13,"Transient","","A transient failure which likely can be resolved or worked…",2,null],[13,"NotReady","","Not ready yet: recommended to try again a little later.",2,null],[3,"Error","","Error type of random number generators",null,null],[12,"kind","","The error kind",3,null],[12,"msg","","The error message",3,null],[5,"thread_rng","","Retrieve the lazily-initialized thread-local random number…",null,[[],["threadrng"]]],[5,"random","","Generates a random value using the thread-local random…",null,[[],["t"]]],[0,"distributions","","Generating random samples from probability distributions.",null,null],[3,"Alphanumeric","rand::distributions","Sample a `char`, uniformly distributed over ASCII letters…",null,null],[3,"Uniform","","Sample values uniformly between two bounds.",null,null],[3,"OpenClosed01","","A distribution to sample floating point numbers uniformly…",null,null],[3,"Open01","","A distribution to sample floating point numbers uniformly…",null,null],[3,"Bernoulli","","The Bernoulli distribution.",null,null],[3,"WeightedIndex","","A distribution using weighted sampling to pick a…",null,null],[3,"UnitSphereSurface","","Samples uniformly from the surface of the unit sphere in…",null,null],[3,"UnitCircle","","Samples uniformly from the edge of the unit circle in two…",null,null],[3,"Gamma","","The Gamma distribution `Gamma(shape, scale)` distribution.",null,null],[3,"ChiSquared","","The chi-squared distribution `χ²(k)`, where `k` is the…",null,null],[3,"FisherF","","The Fisher F distribution `F(m, n)`.",null,null],[3,"StudentT","","The Student t distribution, `t(nu)`, where `nu` is the…",null,null],[3,"Beta","","The Beta distribution with shape parameters `alpha` and…",null,null],[3,"Normal","","The normal distribution `N(mean, std_dev**2)`.",null,null],[3,"LogNormal","","The log-normal distribution `ln N(mean, std_dev**2)`.",null,null],[3,"StandardNormal","","Samples floating-point numbers according to the normal…",null,null],[3,"Exp","","The exponential distribution `Exp(lambda)`.",null,null],[3,"Exp1","","Samples floating-point numbers according to the…",null,null],[3,"Pareto","","Samples floating-point numbers according to the Pareto…",null,null],[3,"Poisson","","The Poisson distribution `Poisson(lambda)`.",null,null],[3,"Binomial","","The binomial distribution `Binomial(n, p)`.",null,null],[3,"Cauchy","","The Cauchy distribution `Cauchy(median, scale)`.",null,null],[3,"Dirichlet","","The dirichelet distribution `Dirichlet(alpha)`.",null,null],[3,"Triangular","","The triangular distribution.",null,null],[3,"Weibull","","Samples floating-point numbers according to the Weibull…",null,null],[3,"DistIter","","An iterator that generates random values of `T` with…",null,null],[3,"Standard","","A generic random value distribution, implemented for many…",null,null],[3,"Weighted","","A value with a particular weight for use with…",null,null],[12,"weight","","The numerical weight of this item",4,null],[12,"item","","The actual item which is being weighted",4,null],[3,"WeightedChoice","","A distribution that selects from a finite collection of…",null,null],[4,"WeightedError","","Error type returned from `WeightedIndex::new`.",null,null],[13,"NoItem","","The provided iterator contained no items.",5,null],[13,"NegativeWeight","","A weight lower than zero was used.",5,null],[13,"AllWeightsZero","","All items in the provided iterator had a weight of zero.",5,null],[0,"uniform","","A distribution uniformly sampling numbers within a given…",null,null],[3,"Uniform","rand::distributions::uniform","Sample values uniformly between two bounds.",null,null],[3,"UniformInt","","The back-end implementing [`UniformSampler`] for integer…",null,null],[3,"UniformFloat","","The back-end implementing [`UniformSampler`] for…",null,null],[3,"UniformDuration","","The back-end implementing [`UniformSampler`] for `Duration`.",null,null],[8,"SampleUniform","","Helper trait for creating objects using the correct…",null,null],[16,"Sampler","","The `UniformSampler` implementation supporting type `X`.",6,null],[8,"UniformSampler","","Helper trait handling actual uniform sampling.",null,null],[16,"X","","The type sampled by this implementation.",7,null],[10,"new","","Construct self, with inclusive lower bound and exclusive…",7,[[["b2"],["b1"]],["self"]]],[10,"new_inclusive","","Construct self, with inclusive bounds `[low, high]`.",7,[[["b2"],["b1"]],["self"]]],[10,"sample","","Sample a value.",7,[[["self"],["r"]]]],[11,"sample_single","","Sample a single value uniformly from a range with…",7,[[["b2"],["b1"],["r"]]]],[8,"SampleBorrow","","Helper trait similar to [`Borrow`] but implemented only…",null,null],[10,"borrow","","Immutably borrows from an owned value. See…",8,[[["self"]],["borrowed"]]],[11,"new","","Create a new `Uniform` instance which samples uniformly…",9,[[["b2"],["b1"]],["uniform"]]],[11,"new_inclusive","","Create a new `Uniform` instance which samples uniformly…",9,[[["b2"],["b1"]],["uniform"]]],[11,"new","rand::distributions","Construct a new `Bernoulli` with the given probability of…",10,[[["f64"]],["bernoulli"]]],[11,"from_ratio","","Construct a new `Bernoulli` with the probability of…",10,[[["u32"]],["bernoulli"]]],[11,"new","","Creates a new a `WeightedIndex` [`Distribution`] using the…",11,[[["i"]],[["weightederror"],["result",["weightedindex","weightederror"]],["weightedindex"]]]],[11,"new","","Construct a new `UnitSphereSurface` distribution.",12,[[],["unitspheresurface"]]],[11,"new","","Construct a new `UnitCircle` distribution.",13,[[],["unitcircle"]]],[11,"new","","Construct an object representing the `Gamma(shape, scale)`…",14,[[["f64"]],["gamma"]]],[11,"new","","Create a new chi-squared distribution with…",15,[[["f64"]],["chisquared"]]],[11,"new","","Create a new `FisherF` distribution, with the given…",16,[[["f64"]],["fisherf"]]],[11,"new","","Create a new Student t distribution with `n` degrees of…",17,[[["f64"]],["studentt"]]],[11,"new","","Construct an object representing the `Beta(alpha, beta)`…",18,[[["f64"]],["beta"]]],[11,"new","","Construct a new `Normal` distribution with the given mean…",19,[[["f64"]],["normal"]]],[11,"new","","Construct a new `LogNormal` distribution with the given…",20,[[["f64"]],["lognormal"]]],[11,"new","","Construct a new `Exp` with the given shape parameter…",21,[[["f64"]],["exp"]]],[11,"new","","Construct a new Pareto distribution with given `scale` and…",22,[[["f64"]],["pareto"]]],[11,"new","","Construct a new `Poisson` with the given shape parameter…",23,[[["f64"]],["poisson"]]],[11,"new","","Construct a new `Binomial` with the given shape parameters…",24,[[["f64"],["u64"]],["binomial"]]],[11,"new","","Construct a new `Cauchy` with the given shape parameters…",25,[[["f64"]],["cauchy"]]],[11,"new","","Construct a new `Dirichlet` with the given alpha parameter…",26,[[["into",["vec"]],["vec",["f64"]]],["dirichlet"]]],[11,"new_with_param","","Construct a new `Dirichlet` with the given shape parameter…",26,[[["f64"],["usize"]],["dirichlet"]]],[11,"new","","Construct a new `Triangular` with minimum `min`, maximum…",27,[[["f64"]],["triangular"]]],[11,"new","","Construct a new `Weibull` distribution with given `scale`…",28,[[["f64"]],["weibull"]]],[8,"Distribution","","Types (distributions) that can be used to create a random…",null,null],[10,"sample","","Generate a random value of `T`, using `rng` as the source…",29,[[["self"],["r"]],["t"]]],[11,"sample_iter","","Create an iterator that generates random values of `T`,…",29,[[["self"],["r"]],["distiter"]]],[11,"new","","Create a new `WeightedChoice`.",30,[[],["weightedchoice"]]],[0,"prelude","rand","Convenience re-export of common members",null,null],[0,"prng","","Pseudo-random number generators.",null,null],[0,"rngs","","Random number generators and adapters for common usage:",null,null],[3,"JitterRng","rand::rngs","A true random number generator based on jitter in the CPU…",null,null],[4,"TimerError","","An error that can occur when [`JitterRng::test_timer`]…",null,null],[13,"NoTimer","","No timer available.",31,null],[13,"CoarseTimer","","Timer too coarse to use as an entropy source.",31,null],[13,"NotMonotonic","","Timer is not monotonically increasing.",31,null],[13,"TinyVariantions","","Variations of deltas of time too small.",31,null],[13,"TooManyStuck","","Too many stuck results (indicating no added entropy).",31,null],[3,"OsRng","","A random number generator that retrieves randomness…",null,null],[3,"EntropyRng","","An interface returning random data from external…",null,null],[3,"SmallRng","","An RNG recommended when small state, cheap initialization…",null,null],[3,"StdRng","","The standard RNG. The PRNG algorithm in `StdRng` is chosen…",null,null],[3,"ThreadRng","","The type returned by [`thread_rng`], essentially just a…",null,null],[0,"adapter","","Wrappers / adapters forming RNGs",null,null],[3,"ReadRng","rand::rngs::adapter","An RNG that reads random bytes straight from any type…",null,null],[3,"ReseedingRng","","A wrapper around any PRNG that implements…",null,null],[11,"new","","Create a new `ReadRng` from a `Read`.",32,[[["r"]],["readrng"]]],[11,"new","","Create a new `ReseedingRng` from an existing PRNG,…",33,[[["rsdr"],["u64"],["r"]],["self"]]],[11,"reseed","","Reseed the internal PRNG.",33,[[["self"]],[["result",["error"]],["error"]]]],[11,"new","rand::rngs","Create a new `EntropyRng`.",34,[[],["self"]]],[0,"mock","","Mock random number generator",null,null],[3,"StepRng","rand::rngs::mock","A simple implementation of `RngCore` for testing purposes.",null,null],[11,"new","","Create a `StepRng`, yielding an arithmetic sequence…",35,[[["u64"]],["self"]]],[0,"seq","rand","Functions for randomly accessing and sampling sequences.",null,null],[3,"SliceChooseIter","rand::seq","Iterator over multiple choices, as returned by…",null,null],[5,"sample_iter","","Randomly sample `amount` elements from a finite iterator.",null,[[["i"],["usize"],["r"]],[["vec"],["result",["vec","vec"]]]]],[5,"sample_slice","","Randomly sample exactly `amount` values from `slice`.",null,[[["usize"],["r"]],["vec"]]],[5,"sample_slice_ref","","Randomly sample exactly `amount` references from `slice`.",null,[[["usize"],["r"]],[["vec"],["t"]]]],[0,"index","","Index sampling",null,null],[4,"IndexVec","rand::seq::index","A vector of indices.",null,null],[4,"IndexVecIter","","Return type of `IndexVec::iter`.",null,null],[4,"IndexVecIntoIter","","Return type of `IndexVec::into_iter`.",null,null],[5,"sample","","Randomly sample exactly `amount` distinct indices from…",null,[[["usize"],["r"]],["indexvec"]]],[11,"len","","Returns the number of indices",36,[[["self"]],["usize"]]],[11,"index","","Return the value at the given `index`.",36,[[["self"],["usize"]],["usize"]]],[11,"into_vec","","Return result as a `Vec`. Conversion may or may not…",36,[[],[["vec",["usize"]],["usize"]]]],[11,"iter","","Iterate over the indices as a sequence of `usize` values",36,[[["self"]],["indexveciter"]]],[11,"into_iter","","Convert into an iterator over the indices as a sequence of…",36,[[],["indexvecintoiter"]]],[8,"SliceRandom","rand::seq","Extension trait on slices, providing random mutation and…",null,null],[16,"Item","","The element type.",37,null],[10,"choose","","Returns a reference to one random element of the slice, or…",37,[[["self"],["r"]],["option"]]],[10,"choose_mut","","Returns a mutable reference to one random element of the…",37,[[["self"],["r"]],["option"]]],[10,"choose_multiple","","Produces an iterator that chooses `amount` elements from…",37,[[["usize"],["self"],["r"]],["slicechooseiter"]]],[10,"choose_weighted","","Similar to [`choose`], where the likelihood of each…",37,[[["f"],["self"],["r"]],[["weightederror"],["result",["weightederror"]]]]],[10,"choose_weighted_mut","","Similar to [`choose_mut`], where the likelihood of each…",37,[[["self"],["f"],["r"]],[["weightederror"],["result",["weightederror"]]]]],[10,"shuffle","","Shuffle a mutable slice in place.",37,[[["self"],["r"]]]],[10,"partial_shuffle","","Shuffle a slice in place, but exit early.",37,[[["self"],["usize"],["r"]]]],[8,"IteratorRandom","","Extension trait on iterators, providing random sampling…",null,null],[11,"choose","","Choose one element at random from the iterator. If you…",38,[[["r"]],["option"]]],[11,"choose_multiple_fill","","Collects `amount` values at random from the iterator into…",38,[[["r"]],["usize"]]],[11,"choose_multiple","","Collects `amount` values at random from the iterator into…",38,[[["usize"],["r"]],["vec"]]],[8,"Rng","rand","An automatically-implemented extension trait on…",null,null],[11,"gen","","Return a random value supporting the [`Standard`]…",39,[[["self"]],["t"]]],[11,"gen_range","","Generate a random value in the range [`low`, `high`), i.e.…",39,[[["b2"],["self"],["b1"]],["sampleuniform"]]],[11,"sample","","Sample a new value, using the given distribution.",39,[[["distribution"],["self"]],["t"]]],[11,"sample_iter","","Create an iterator that generates values using the given…",39,[[["d"],["self"]],[["distiter"],["distribution"]]]],[11,"fill","","Fill `dest` entirely with random bytes (uniform value…",39,[[["self"],["t"]]]],[11,"try_fill","","Fill `dest` entirely with random bytes (uniform value…",39,[[["self"],["t"]],[["result",["error"]],["error"]]]],[11,"gen_bool","","Return a bool with a probability `p` of being true.",39,[[["self"],["f64"]],["bool"]]],[11,"gen_ratio","","Return a bool with a probability of…",39,[[["self"],["u32"]],["bool"]]],[11,"choose","","Return a random element from `values`.",39,[[["self"]],[["option"],["t"]]]],[11,"choose_mut","","Return a mutable pointer to a random element from `values`.",39,[[["self"]],[["option"],["t"]]]],[11,"shuffle","","Shuffle a mutable slice in place.",39,[[["self"]]]],[8,"AsByteSliceMut","","Trait for casting types to byte slices",null,null],[10,"as_byte_slice_mut","","Return a mutable reference to self as a byte slice",40,[[["self"]]]],[10,"to_le","","Call `to_le` on each element (i.e. byte-swap on Big Endian…",40,[[["self"]]]],[8,"FromEntropy","","A convenience extension to [`SeedableRng`] allowing…",null,null],[10,"from_entropy","","Creates a new instance, automatically seeded with fresh…",41,[[],["self"]]],[11,"from","","",2,[[["t"]],["t"]]],[11,"into","","",2,[[],["u"]]],[11,"to_owned","","",2,[[["self"]],["t"]]],[11,"clone_into","","",2,[[["self"],["t"]]]],[11,"try_from","","",2,[[["u"]],["result"]]],[11,"try_into","","",2,[[],["result"]]],[11,"borrow","","",2,[[["self"]],["t"]]],[11,"borrow_mut","","",2,[[["self"]],["t"]]],[11,"type_id","","",2,[[["self"]],["typeid"]]],[11,"from","","",3,[[["t"]],["t"]]],[11,"into","","",3,[[],["u"]]],[11,"to_string","","",3,[[["self"]],["string"]]],[11,"try_from","","",3,[[["u"]],["result"]]],[11,"try_into","","",3,[[],["result"]]],[11,"borrow","","",3,[[["self"]],["t"]]],[11,"borrow_mut","","",3,[[["self"]],["t"]]],[11,"type_id","","",3,[[["self"]],["typeid"]]],[11,"from","rand::distributions","",42,[[["t"]],["t"]]],[11,"into","","",42,[[],["u"]]],[11,"try_from","","",42,[[["u"]],["result"]]],[11,"try_into","","",42,[[],["result"]]],[11,"borrow","","",42,[[["self"]],["t"]]],[11,"borrow_mut","","",42,[[["self"]],["t"]]],[11,"type_id","","",42,[[["self"]],["typeid"]]],[11,"from","rand::distributions::uniform","",9,[[["t"]],["t"]]],[11,"into","","",9,[[],["u"]]],[11,"to_owned","","",9,[[["self"]],["t"]]],[11,"clone_into","","",9,[[["self"],["t"]]]],[11,"try_from","","",9,[[["u"]],["result"]]],[11,"try_into","","",9,[[],["result"]]],[11,"borrow","","",9,[[["self"]],["t"]]],[11,"borrow_mut","","",9,[[["self"]],["t"]]],[11,"type_id","","",9,[[["self"]],["typeid"]]],[11,"from","rand::distributions","",43,[[["t"]],["t"]]],[11,"into","","",43,[[],["u"]]],[11,"to_owned","","",43,[[["self"]],["t"]]],[11,"clone_into","","",43,[[["self"],["t"]]]],[11,"try_from","","",43,[[["u"]],["result"]]],[11,"try_into","","",43,[[],["result"]]],[11,"borrow","","",43,[[["self"]],["t"]]],[11,"borrow_mut","","",43,[[["self"]],["t"]]],[11,"type_id","","",43,[[["self"]],["typeid"]]],[11,"from","","",44,[[["t"]],["t"]]],[11,"into","","",44,[[],["u"]]],[11,"to_owned","","",44,[[["self"]],["t"]]],[11,"clone_into","","",44,[[["self"],["t"]]]],[11,"try_from","","",44,[[["u"]],["result"]]],[11,"try_into","","",44,[[],["result"]]],[11,"borrow","","",44,[[["self"]],["t"]]],[11,"borrow_mut","","",44,[[["self"]],["t"]]],[11,"type_id","","",44,[[["self"]],["typeid"]]],[11,"from","","",10,[[["t"]],["t"]]],[11,"into","","",10,[[],["u"]]],[11,"to_owned","","",10,[[["self"]],["t"]]],[11,"clone_into","","",10,[[["self"],["t"]]]],[11,"try_from","","",10,[[["u"]],["result"]]],[11,"try_into","","",10,[[],["result"]]],[11,"borrow","","",10,[[["self"]],["t"]]],[11,"borrow_mut","","",10,[[["self"]],["t"]]],[11,"type_id","","",10,[[["self"]],["typeid"]]],[11,"from","","",11,[[["t"]],["t"]]],[11,"into","","",11,[[],["u"]]],[11,"to_owned","","",11,[[["self"]],["t"]]],[11,"clone_into","","",11,[[["self"],["t"]]]],[11,"try_from","","",11,[[["u"]],["result"]]],[11,"try_into","","",11,[[],["result"]]],[11,"borrow","","",11,[[["self"]],["t"]]],[11,"borrow_mut","","",11,[[["self"]],["t"]]],[11,"type_id","","",11,[[["self"]],["typeid"]]],[11,"from","","",12,[[["t"]],["t"]]],[11,"into","","",12,[[],["u"]]],[11,"to_owned","","",12,[[["self"]],["t"]]],[11,"clone_into","","",12,[[["self"],["t"]]]],[11,"try_from","","",12,[[["u"]],["result"]]],[11,"try_into","","",12,[[],["result"]]],[11,"borrow","","",12,[[["self"]],["t"]]],[11,"borrow_mut","","",12,[[["self"]],["t"]]],[11,"type_id","","",12,[[["self"]],["typeid"]]],[11,"from","","",13,[[["t"]],["t"]]],[11,"into","","",13,[[],["u"]]],[11,"to_owned","","",13,[[["self"]],["t"]]],[11,"clone_into","","",13,[[["self"],["t"]]]],[11,"try_from","","",13,[[["u"]],["result"]]],[11,"try_into","","",13,[[],["result"]]],[11,"borrow","","",13,[[["self"]],["t"]]],[11,"borrow_mut","","",13,[[["self"]],["t"]]],[11,"type_id","","",13,[[["self"]],["typeid"]]],[11,"from","","",14,[[["t"]],["t"]]],[11,"into","","",14,[[],["u"]]],[11,"to_owned","","",14,[[["self"]],["t"]]],[11,"clone_into","","",14,[[["self"],["t"]]]],[11,"try_from","","",14,[[["u"]],["result"]]],[11,"try_into","","",14,[[],["result"]]],[11,"borrow","","",14,[[["self"]],["t"]]],[11,"borrow_mut","","",14,[[["self"]],["t"]]],[11,"type_id","","",14,[[["self"]],["typeid"]]],[11,"from","","",15,[[["t"]],["t"]]],[11,"into","","",15,[[],["u"]]],[11,"to_owned","","",15,[[["self"]],["t"]]],[11,"clone_into","","",15,[[["self"],["t"]]]],[11,"try_from","","",15,[[["u"]],["result"]]],[11,"try_into","","",15,[[],["result"]]],[11,"borrow","","",15,[[["self"]],["t"]]],[11,"borrow_mut","","",15,[[["self"]],["t"]]],[11,"type_id","","",15,[[["self"]],["typeid"]]],[11,"from","","",16,[[["t"]],["t"]]],[11,"into","","",16,[[],["u"]]],[11,"to_owned","","",16,[[["self"]],["t"]]],[11,"clone_into","","",16,[[["self"],["t"]]]],[11,"try_from","","",16,[[["u"]],["result"]]],[11,"try_into","","",16,[[],["result"]]],[11,"borrow","","",16,[[["self"]],["t"]]],[11,"borrow_mut","","",16,[[["self"]],["t"]]],[11,"type_id","","",16,[[["self"]],["typeid"]]],[11,"from","","",17,[[["t"]],["t"]]],[11,"into","","",17,[[],["u"]]],[11,"to_owned","","",17,[[["self"]],["t"]]],[11,"clone_into","","",17,[[["self"],["t"]]]],[11,"try_from","","",17,[[["u"]],["result"]]],[11,"try_into","","",17,[[],["result"]]],[11,"borrow","","",17,[[["self"]],["t"]]],[11,"borrow_mut","","",17,[[["self"]],["t"]]],[11,"type_id","","",17,[[["self"]],["typeid"]]],[11,"from","","",18,[[["t"]],["t"]]],[11,"into","","",18,[[],["u"]]],[11,"to_owned","","",18,[[["self"]],["t"]]],[11,"clone_into","","",18,[[["self"],["t"]]]],[11,"try_from","","",18,[[["u"]],["result"]]],[11,"try_into","","",18,[[],["result"]]],[11,"borrow","","",18,[[["self"]],["t"]]],[11,"borrow_mut","","",18,[[["self"]],["t"]]],[11,"type_id","","",18,[[["self"]],["typeid"]]],[11,"from","","",19,[[["t"]],["t"]]],[11,"into","","",19,[[],["u"]]],[11,"to_owned","","",19,[[["self"]],["t"]]],[11,"clone_into","","",19,[[["self"],["t"]]]],[11,"try_from","","",19,[[["u"]],["result"]]],[11,"try_into","","",19,[[],["result"]]],[11,"borrow","","",19,[[["self"]],["t"]]],[11,"borrow_mut","","",19,[[["self"]],["t"]]],[11,"type_id","","",19,[[["self"]],["typeid"]]],[11,"from","","",20,[[["t"]],["t"]]],[11,"into","","",20,[[],["u"]]],[11,"to_owned","","",20,[[["self"]],["t"]]],[11,"clone_into","","",20,[[["self"],["t"]]]],[11,"try_from","","",20,[[["u"]],["result"]]],[11,"try_into","","",20,[[],["result"]]],[11,"borrow","","",20,[[["self"]],["t"]]],[11,"borrow_mut","","",20,[[["self"]],["t"]]],[11,"type_id","","",20,[[["self"]],["typeid"]]],[11,"from","","",45,[[["t"]],["t"]]],[11,"into","","",45,[[],["u"]]],[11,"to_owned","","",45,[[["self"]],["t"]]],[11,"clone_into","","",45,[[["self"],["t"]]]],[11,"try_from","","",45,[[["u"]],["result"]]],[11,"try_into","","",45,[[],["result"]]],[11,"borrow","","",45,[[["self"]],["t"]]],[11,"borrow_mut","","",45,[[["self"]],["t"]]],[11,"type_id","","",45,[[["self"]],["typeid"]]],[11,"from","","",21,[[["t"]],["t"]]],[11,"into","","",21,[[],["u"]]],[11,"to_owned","","",21,[[["self"]],["t"]]],[11,"clone_into","","",21,[[["self"],["t"]]]],[11,"try_from","","",21,[[["u"]],["result"]]],[11,"try_into","","",21,[[],["result"]]],[11,"borrow","","",21,[[["self"]],["t"]]],[11,"borrow_mut","","",21,[[["self"]],["t"]]],[11,"type_id","","",21,[[["self"]],["typeid"]]],[11,"from","","",46,[[["t"]],["t"]]],[11,"into","","",46,[[],["u"]]],[11,"to_owned","","",46,[[["self"]],["t"]]],[11,"clone_into","","",46,[[["self"],["t"]]]],[11,"try_from","","",46,[[["u"]],["result"]]],[11,"try_into","","",46,[[],["result"]]],[11,"borrow","","",46,[[["self"]],["t"]]],[11,"borrow_mut","","",46,[[["self"]],["t"]]],[11,"type_id","","",46,[[["self"]],["typeid"]]],[11,"from","","",22,[[["t"]],["t"]]],[11,"into","","",22,[[],["u"]]],[11,"to_owned","","",22,[[["self"]],["t"]]],[11,"clone_into","","",22,[[["self"],["t"]]]],[11,"try_from","","",22,[[["u"]],["result"]]],[11,"try_into","","",22,[[],["result"]]],[11,"borrow","","",22,[[["self"]],["t"]]],[11,"borrow_mut","","",22,[[["self"]],["t"]]],[11,"type_id","","",22,[[["self"]],["typeid"]]],[11,"from","","",23,[[["t"]],["t"]]],[11,"into","","",23,[[],["u"]]],[11,"to_owned","","",23,[[["self"]],["t"]]],[11,"clone_into","","",23,[[["self"],["t"]]]],[11,"try_from","","",23,[[["u"]],["result"]]],[11,"try_into","","",23,[[],["result"]]],[11,"borrow","","",23,[[["self"]],["t"]]],[11,"borrow_mut","","",23,[[["self"]],["t"]]],[11,"type_id","","",23,[[["self"]],["typeid"]]],[11,"from","","",24,[[["t"]],["t"]]],[11,"into","","",24,[[],["u"]]],[11,"to_owned","","",24,[[["self"]],["t"]]],[11,"clone_into","","",24,[[["self"],["t"]]]],[11,"try_from","","",24,[[["u"]],["result"]]],[11,"try_into","","",24,[[],["result"]]],[11,"borrow","","",24,[[["self"]],["t"]]],[11,"borrow_mut","","",24,[[["self"]],["t"]]],[11,"type_id","","",24,[[["self"]],["typeid"]]],[11,"from","","",25,[[["t"]],["t"]]],[11,"into","","",25,[[],["u"]]],[11,"to_owned","","",25,[[["self"]],["t"]]],[11,"clone_into","","",25,[[["self"],["t"]]]],[11,"try_from","","",25,[[["u"]],["result"]]],[11,"try_into","","",25,[[],["result"]]],[11,"borrow","","",25,[[["self"]],["t"]]],[11,"borrow_mut","","",25,[[["self"]],["t"]]],[11,"type_id","","",25,[[["self"]],["typeid"]]],[11,"from","","",26,[[["t"]],["t"]]],[11,"into","","",26,[[],["u"]]],[11,"to_owned","","",26,[[["self"]],["t"]]],[11,"clone_into","","",26,[[["self"],["t"]]]],[11,"try_from","","",26,[[["u"]],["result"]]],[11,"try_into","","",26,[[],["result"]]],[11,"borrow","","",26,[[["self"]],["t"]]],[11,"borrow_mut","","",26,[[["self"]],["t"]]],[11,"type_id","","",26,[[["self"]],["typeid"]]],[11,"from","","",27,[[["t"]],["t"]]],[11,"into","","",27,[[],["u"]]],[11,"to_owned","","",27,[[["self"]],["t"]]],[11,"clone_into","","",27,[[["self"],["t"]]]],[11,"try_from","","",27,[[["u"]],["result"]]],[11,"try_into","","",27,[[],["result"]]],[11,"borrow","","",27,[[["self"]],["t"]]],[11,"borrow_mut","","",27,[[["self"]],["t"]]],[11,"type_id","","",27,[[["self"]],["typeid"]]],[11,"from","","",28,[[["t"]],["t"]]],[11,"into","","",28,[[],["u"]]],[11,"to_owned","","",28,[[["self"]],["t"]]],[11,"clone_into","","",28,[[["self"],["t"]]]],[11,"try_from","","",28,[[["u"]],["result"]]],[11,"try_into","","",28,[[],["result"]]],[11,"borrow","","",28,[[["self"]],["t"]]],[11,"borrow_mut","","",28,[[["self"]],["t"]]],[11,"type_id","","",28,[[["self"]],["typeid"]]],[11,"from","","",47,[[["t"]],["t"]]],[11,"into","","",47,[[],["u"]]],[11,"into_iter","","",47,[[],["i"]]],[11,"try_from","","",47,[[["u"]],["result"]]],[11,"try_into","","",47,[[],["result"]]],[11,"borrow","","",47,[[["self"]],["t"]]],[11,"borrow_mut","","",47,[[["self"]],["t"]]],[11,"type_id","","",47,[[["self"]],["typeid"]]],[11,"from","","",48,[[["t"]],["t"]]],[11,"into","","",48,[[],["u"]]],[11,"to_owned","","",48,[[["self"]],["t"]]],[11,"clone_into","","",48,[[["self"],["t"]]]],[11,"try_from","","",48,[[["u"]],["result"]]],[11,"try_into","","",48,[[],["result"]]],[11,"borrow","","",48,[[["self"]],["t"]]],[11,"borrow_mut","","",48,[[["self"]],["t"]]],[11,"type_id","","",48,[[["self"]],["typeid"]]],[11,"from","","",4,[[["t"]],["t"]]],[11,"into","","",4,[[],["u"]]],[11,"to_owned","","",4,[[["self"]],["t"]]],[11,"clone_into","","",4,[[["self"],["t"]]]],[11,"try_from","","",4,[[["u"]],["result"]]],[11,"try_into","","",4,[[],["result"]]],[11,"borrow","","",4,[[["self"]],["t"]]],[11,"borrow_mut","","",4,[[["self"]],["t"]]],[11,"type_id","","",4,[[["self"]],["typeid"]]],[11,"from","","",30,[[["t"]],["t"]]],[11,"into","","",30,[[],["u"]]],[11,"try_from","","",30,[[["u"]],["result"]]],[11,"try_into","","",30,[[],["result"]]],[11,"borrow","","",30,[[["self"]],["t"]]],[11,"borrow_mut","","",30,[[["self"]],["t"]]],[11,"type_id","","",30,[[["self"]],["typeid"]]],[11,"from","","",5,[[["t"]],["t"]]],[11,"into","","",5,[[],["u"]]],[11,"to_owned","","",5,[[["self"]],["t"]]],[11,"clone_into","","",5,[[["self"],["t"]]]],[11,"to_string","","",5,[[["self"]],["string"]]],[11,"try_from","","",5,[[["u"]],["result"]]],[11,"try_into","","",5,[[],["result"]]],[11,"borrow","","",5,[[["self"]],["t"]]],[11,"borrow_mut","","",5,[[["self"]],["t"]]],[11,"type_id","","",5,[[["self"]],["typeid"]]],[11,"from","rand::distributions::uniform","",49,[[["t"]],["t"]]],[11,"into","","",49,[[],["u"]]],[11,"to_owned","","",49,[[["self"]],["t"]]],[11,"clone_into","","",49,[[["self"],["t"]]]],[11,"try_from","","",49,[[["u"]],["result"]]],[11,"try_into","","",49,[[],["result"]]],[11,"borrow","","",49,[[["self"]],["t"]]],[11,"borrow_mut","","",49,[[["self"]],["t"]]],[11,"type_id","","",49,[[["self"]],["typeid"]]],[11,"from","","",50,[[["t"]],["t"]]],[11,"into","","",50,[[],["u"]]],[11,"to_owned","","",50,[[["self"]],["t"]]],[11,"clone_into","","",50,[[["self"],["t"]]]],[11,"try_from","","",50,[[["u"]],["result"]]],[11,"try_into","","",50,[[],["result"]]],[11,"borrow","","",50,[[["self"]],["t"]]],[11,"borrow_mut","","",50,[[["self"]],["t"]]],[11,"type_id","","",50,[[["self"]],["typeid"]]],[11,"from","","",51,[[["t"]],["t"]]],[11,"into","","",51,[[],["u"]]],[11,"to_owned","","",51,[[["self"]],["t"]]],[11,"clone_into","","",51,[[["self"],["t"]]]],[11,"try_from","","",51,[[["u"]],["result"]]],[11,"try_into","","",51,[[],["result"]]],[11,"borrow","","",51,[[["self"]],["t"]]],[11,"borrow_mut","","",51,[[["self"]],["t"]]],[11,"type_id","","",51,[[["self"]],["typeid"]]],[11,"from","rand::rngs","",52,[[["t"]],["t"]]],[11,"into","","",52,[[],["u"]]],[11,"to_owned","","",52,[[["self"]],["t"]]],[11,"clone_into","","",52,[[["self"],["t"]]]],[11,"try_from","","",52,[[["u"]],["result"]]],[11,"try_into","","",52,[[],["result"]]],[11,"borrow","","",52,[[["self"]],["t"]]],[11,"borrow_mut","","",52,[[["self"]],["t"]]],[11,"type_id","","",52,[[["self"]],["typeid"]]],[11,"from","","",31,[[["t"]],["t"]]],[11,"into","","",31,[[],["u"]]],[11,"to_owned","","",31,[[["self"]],["t"]]],[11,"clone_into","","",31,[[["self"],["t"]]]],[11,"to_string","","",31,[[["self"]],["string"]]],[11,"try_from","","",31,[[["u"]],["result"]]],[11,"try_into","","",31,[[],["result"]]],[11,"borrow","","",31,[[["self"]],["t"]]],[11,"borrow_mut","","",31,[[["self"]],["t"]]],[11,"type_id","","",31,[[["self"]],["typeid"]]],[11,"from","","",53,[[["t"]],["t"]]],[11,"into","","",53,[[],["u"]]],[11,"to_owned","","",53,[[["self"]],["t"]]],[11,"clone_into","","",53,[[["self"],["t"]]]],[11,"try_from","","",53,[[["u"]],["result"]]],[11,"try_into","","",53,[[],["result"]]],[11,"borrow","","",53,[[["self"]],["t"]]],[11,"borrow_mut","","",53,[[["self"]],["t"]]],[11,"type_id","","",53,[[["self"]],["typeid"]]],[11,"from","","",34,[[["t"]],["t"]]],[11,"into","","",34,[[],["u"]]],[11,"try_from","","",34,[[["u"]],["result"]]],[11,"try_into","","",34,[[],["result"]]],[11,"borrow","","",34,[[["self"]],["t"]]],[11,"borrow_mut","","",34,[[["self"]],["t"]]],[11,"type_id","","",34,[[["self"]],["typeid"]]],[11,"from_entropy","","",54,[[],["r"]]],[11,"from","","",54,[[["t"]],["t"]]],[11,"into","","",54,[[],["u"]]],[11,"to_owned","","",54,[[["self"]],["t"]]],[11,"clone_into","","",54,[[["self"],["t"]]]],[11,"try_from","","",54,[[["u"]],["result"]]],[11,"try_into","","",54,[[],["result"]]],[11,"borrow","","",54,[[["self"]],["t"]]],[11,"borrow_mut","","",54,[[["self"]],["t"]]],[11,"type_id","","",54,[[["self"]],["typeid"]]],[11,"from_entropy","","",55,[[],["r"]]],[11,"from","","",55,[[["t"]],["t"]]],[11,"into","","",55,[[],["u"]]],[11,"to_owned","","",55,[[["self"]],["t"]]],[11,"clone_into","","",55,[[["self"],["t"]]]],[11,"try_from","","",55,[[["u"]],["result"]]],[11,"try_into","","",55,[[],["result"]]],[11,"borrow","","",55,[[["self"]],["t"]]],[11,"borrow_mut","","",55,[[["self"]],["t"]]],[11,"type_id","","",55,[[["self"]],["typeid"]]],[11,"from","","",56,[[["t"]],["t"]]],[11,"into","","",56,[[],["u"]]],[11,"to_owned","","",56,[[["self"]],["t"]]],[11,"clone_into","","",56,[[["self"],["t"]]]],[11,"try_from","","",56,[[["u"]],["result"]]],[11,"try_into","","",56,[[],["result"]]],[11,"borrow","","",56,[[["self"]],["t"]]],[11,"borrow_mut","","",56,[[["self"]],["t"]]],[11,"type_id","","",56,[[["self"]],["typeid"]]],[11,"from","rand::rngs::adapter","",32,[[["t"]],["t"]]],[11,"into","","",32,[[],["u"]]],[11,"try_from","","",32,[[["u"]],["result"]]],[11,"try_into","","",32,[[],["result"]]],[11,"borrow","","",32,[[["self"]],["t"]]],[11,"borrow_mut","","",32,[[["self"]],["t"]]],[11,"type_id","","",32,[[["self"]],["typeid"]]],[11,"from","","",33,[[["t"]],["t"]]],[11,"into","","",33,[[],["u"]]],[11,"to_owned","","",33,[[["self"]],["t"]]],[11,"clone_into","","",33,[[["self"],["t"]]]],[11,"try_from","","",33,[[["u"]],["result"]]],[11,"try_into","","",33,[[],["result"]]],[11,"borrow","","",33,[[["self"]],["t"]]],[11,"borrow_mut","","",33,[[["self"]],["t"]]],[11,"type_id","","",33,[[["self"]],["typeid"]]],[11,"from","rand::rngs::mock","",35,[[["t"]],["t"]]],[11,"into","","",35,[[],["u"]]],[11,"to_owned","","",35,[[["self"]],["t"]]],[11,"clone_into","","",35,[[["self"],["t"]]]],[11,"try_from","","",35,[[["u"]],["result"]]],[11,"try_into","","",35,[[],["result"]]],[11,"borrow","","",35,[[["self"]],["t"]]],[11,"borrow_mut","","",35,[[["self"]],["t"]]],[11,"type_id","","",35,[[["self"]],["typeid"]]],[11,"from","rand::seq","",57,[[["t"]],["t"]]],[11,"into","","",57,[[],["u"]]],[11,"into_iter","","",57,[[],["i"]]],[11,"try_from","","",57,[[["u"]],["result"]]],[11,"try_into","","",57,[[],["result"]]],[11,"borrow","","",57,[[["self"]],["t"]]],[11,"borrow_mut","","",57,[[["self"]],["t"]]],[11,"type_id","","",57,[[["self"]],["typeid"]]],[11,"from","rand::seq::index","",36,[[["t"]],["t"]]],[11,"into","","",36,[[],["u"]]],[11,"to_owned","","",36,[[["self"]],["t"]]],[11,"clone_into","","",36,[[["self"],["t"]]]],[11,"try_from","","",36,[[["u"]],["result"]]],[11,"try_into","","",36,[[],["result"]]],[11,"borrow","","",36,[[["self"]],["t"]]],[11,"borrow_mut","","",36,[[["self"]],["t"]]],[11,"type_id","","",36,[[["self"]],["typeid"]]],[11,"from","","",58,[[["t"]],["t"]]],[11,"into","","",58,[[],["u"]]],[11,"into_iter","","",58,[[],["i"]]],[11,"try_from","","",58,[[["u"]],["result"]]],[11,"try_into","","",58,[[],["result"]]],[11,"borrow","","",58,[[["self"]],["t"]]],[11,"borrow_mut","","",58,[[["self"]],["t"]]],[11,"type_id","","",58,[[["self"]],["typeid"]]],[11,"from","","",59,[[["t"]],["t"]]],[11,"into","","",59,[[],["u"]]],[11,"into_iter","","",59,[[],["i"]]],[11,"to_owned","","",59,[[["self"]],["t"]]],[11,"clone_into","","",59,[[["self"],["t"]]]],[11,"try_from","","",59,[[["u"]],["result"]]],[11,"try_into","","",59,[[],["result"]]],[11,"borrow","","",59,[[["self"]],["t"]]],[11,"borrow_mut","","",59,[[["self"]],["t"]]],[11,"type_id","","",59,[[["self"]],["typeid"]]],[11,"next_u32","rand::rngs","",52,[[["self"]],["u32"]]],[11,"next_u64","","",52,[[["self"]],["u64"]]],[11,"fill_bytes","","",52,[[["self"]]]],[11,"try_fill_bytes","","",52,[[["self"]],[["result",["error"]],["error"]]]],[11,"description","","",31,[[["self"]],["str"]]],[11,"fmt","","",31,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"from","rand","",3,[[["timererror"]],["error"]]],[11,"eq","rand::rngs","",31,[[["timererror"],["self"]],["bool"]]],[11,"clone","","",52,[[["self"]],["jitterrng"]]],[11,"clone","","",31,[[["self"]],["timererror"]]],[11,"fmt","","",52,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"fmt","","",31,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"fmt","rand","",3,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"fmt","","",2,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"fmt","","",3,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"read","","",0,[[["self"]],[["error"],["result",["usize","error"]],["usize"]]]],[11,"description","","",3,[[["self"]],["str"]]],[11,"cause","","",3,[[["self"]],[["option",["error"]],["error"]]]],[11,"clone","","",2,[[["self"]],["errorkind"]]],[11,"eq","","",2,[[["self"],["errorkind"]],["bool"]]],[11,"fmt","rand::rngs","",53,[[["formatter"],["self"]],[["error"],["result",["error"]]]]],[11,"clone","","",53,[[["self"]],["osrng"]]],[11,"next_u32","","",53,[[["self"]],["u32"]]],[11,"next_u64","","",53,[[["self"]],["u64"]]],[11,"fill_bytes","","",53,[[["self"]]]],[11,"try_fill_bytes","","",53,[[["self"]],[["result",["error"]],["error"]]]],[11,"new","rand::distributions::uniform","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",49,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",49,[[["b2"],["b1"]],["self"]]],[11,"sample","","",49,[[["self"],["r"]]]],[11,"sample_single","","",49,[[["b2"],["b1"],["r"]]]],[11,"new","","",50,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",50,[[["b2"],["b1"]],["self"]]],[11,"sample","","",50,[[["self"],["r"]]]],[11,"sample_single","","",50,[[["b2"],["b1"],["r"]]]],[11,"new","","",50,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",50,[[["b2"],["b1"]],["self"]]],[11,"sample","","",50,[[["self"],["r"]]]],[11,"sample_single","","",50,[[["b2"],["b1"],["r"]]]],[11,"new","","",51,[[["b2"],["b1"]],["self"]]],[11,"new_inclusive","","",51,[[["b2"],["b1"]],["self"]]],[11,"sample","","",51,[[["self"],["r"]],["duration"]]],[11,"sample","","",9,[[["self"],["r"]],["x"]]],[11,"sample","rand::distributions","",10,[[["self"],["r"]],["bool"]]],[11,"sample","","",11,[[["self"],["r"]],["usize"]]],[11,"sample","","",12,[[["self"],["r"]]]],[11,"sample","","",13,[[["self"],["r"]]]],[11,"sample","","",14,[[["self"],["r"]],["f64"]]],[11,"sample","","",15,[[["self"],["r"]],["f64"]]],[11,"sample","","",16,[[["self"],["r"]],["f64"]]],[11,"sample","","",17,[[["self"],["r"]],["f64"]]],[11,"sample","","",18,[[["self"],["r"]],["f64"]]],[11,"sample","","",45,[[["self"],["r"]],["f64"]]],[11,"sample","","",19,[[["self"],["r"]],["f64"]]],[11,"sample","","",20,[[["self"],["r"]],["f64"]]],[11,"sample","","",46,[[["self"],["r"]],["f64"]]],[11,"sample","","",21,[[["self"],["r"]],["f64"]]],[11,"sample","","",22,[[["self"],["r"]],["f64"]]],[11,"sample","","",23,[[["self"],["r"]],["u64"]]],[11,"sample","","",24,[[["self"],["r"]],["u64"]]],[11,"sample","","",25,[[["self"],["r"]],["f64"]]],[11,"sample","","",26,[[["self"],["r"]],[["f64"],["vec",["f64"]]]]],[11,"sample","","",27,[[["self"],["r"]],["f64"]]],[11,"sample","","",28,[[["self"],["r"]],["f64"]]],[11,"sample","","",48,[[["self"],["r"]],["f32"]]],[11,"sample","","",43,[[["self"],["r"]],["f32"]]],[11,"sample","","",44,[[["self"],["r"]],["f32"]]],[11,"sample","","",48,[[["self"],["r"]],["f64"]]],[11,"sample","","",43,[[["self"],["r"]],["f64"]]],[11,"sample","","",44,[[["self"],["r"]],["f64"]]],[11,"sample","","",48,[[["self"],["r"]],["u8"]]],[11,"sample","","",48,[[["self"],["r"]],["u16"]]],[11,"sample","","",48,[[["self"],["r"]],["u32"]]],[11,"sample","","",48,[[["self"],["r"]],["u64"]]],[11,"sample","","",48,[[["self"],["r"]],["u128"]]],[11,"sample","","",48,[[["self"],["r"]],["usize"]]],[11,"sample","","",48,[[["self"],["r"]],["i8"]]],[11,"sample","","",48,[[["self"],["r"]],["i16"]]],[11,"sample","","",48,[[["self"],["r"]],["i32"]]],[11,"sample","","",48,[[["self"],["r"]],["i64"]]],[11,"sample","","",48,[[["self"],["r"]],["i128"]]],[11,"sample","","",48,[[["self"],["r"]],["isize"]]],[11,"sample","","",48,[[["self"],["r"]],["char"]]],[11,"sample","","",42,[[["self"],["r"]],["char"]]],[11,"sample","","",48,[[["self"],["r"]],["bool"]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]]]],[11,"sample","","",48,[[["self"],["r"]],["option"]]],[11,"sample","","",48,[[["self"],["r"]],["wrapping"]]],[11,"sample","","",30,[[["self"],["r"]],["t"]]],[11,"from","rand::distributions::uniform","",9,[[["range"]],["uniform"]]],[11,"from","","",9,[[["rangeinclusive"]],["uniform"]]],[11,"from","rand::seq::index","",36,[[["u32"],["vec",["u32"]]],["self"]]],[11,"from","","",36,[[["vec",["usize"]],["usize"]],["self"]]],[11,"len","rand::seq","",57,[[["self"]],["usize"]]],[11,"next","rand::distributions","",47,[[["self"]],["option"]]],[11,"size_hint","","",47,[[["self"]]]],[11,"next","rand::seq::index","",58,[[["self"]],[["usize"],["option",["usize"]]]]],[11,"size_hint","","",58,[[["self"]]]],[11,"next","","",59,[[["self"]],["option"]]],[11,"size_hint","","",59,[[["self"]]]],[11,"next","rand::seq","",57,[[["self"]],["option"]]],[11,"size_hint","","",57,[[["self"]]]],[11,"clone","rand::distributions::uniform","",9,[[["self"]],["uniform"]]],[11,"clone","","",49,[[["self"]],["uniformint"]]],[11,"clone","","",50,[[["self"]],["uniformfloat"]]],[11,"clone","","",51,[[["self"]],["uniformduration"]]],[11,"clone","rand::distributions","",10,[[["self"]],["bernoulli"]]],[11,"clone","","",11,[[["self"]],["weightedindex"]]],[11,"clone","","",5,[[["self"]],["weightederror"]]],[11,"clone","","",12,[[["self"]],["unitspheresurface"]]],[11,"clone","","",13,[[["self"]],["unitcircle"]]],[11,"clone","","",14,[[["self"]],["gamma"]]],[11,"clone","","",15,[[["self"]],["chisquared"]]],[11,"clone","","",16,[[["self"]],["fisherf"]]],[11,"clone","","",17,[[["self"]],["studentt"]]],[11,"clone","","",18,[[["self"]],["beta"]]],[11,"clone","","",45,[[["self"]],["standardnormal"]]],[11,"clone","","",19,[[["self"]],["normal"]]],[11,"clone","","",20,[[["self"]],["lognormal"]]],[11,"clone","","",46,[[["self"]],["exp1"]]],[11,"clone","","",21,[[["self"]],["exp"]]],[11,"clone","","",22,[[["self"]],["pareto"]]],[11,"clone","","",23,[[["self"]],["poisson"]]],[11,"clone","","",24,[[["self"]],["binomial"]]],[11,"clone","","",25,[[["self"]],["cauchy"]]],[11,"clone","","",26,[[["self"]],["dirichlet"]]],[11,"clone","","",27,[[["self"]],["triangular"]]],[11,"clone","","",28,[[["self"]],["weibull"]]],[11,"clone","","",43,[[["self"]],["openclosed01"]]],[11,"clone","","",44,[[["self"]],["open01"]]],[11,"clone","","",48,[[["self"]],["standard"]]],[11,"clone","","",4,[[["self"]],["weighted"]]],[11,"clone","rand::rngs::adapter","",33,[[["self"]],["reseedingrng"]]],[11,"clone","rand::rngs::mock","",35,[[["self"]],["steprng"]]],[11,"clone","rand::rngs","",54,[[["self"]],["smallrng"]]],[11,"clone","","",55,[[["self"]],["stdrng"]]],[11,"clone","","",56,[[["self"]],["threadrng"]]],[11,"clone","rand::seq::index","",36,[[["self"]],["indexvec"]]],[11,"clone","","",59,[[["self"]],["indexvecintoiter"]]],[11,"default","rand::rngs","",34,[[],["self"]]],[11,"default","","",56,[[],["threadrng"]]],[11,"eq","rand::distributions","",5,[[["self"],["weightederror"]],["bool"]]],[11,"eq","rand::seq::index","",36,[[["indexvec"],["self"]],["bool"]]],[11,"fmt","rand::distributions::uniform","",9,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",49,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",50,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",51,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions","",10,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",11,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",5,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",12,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",13,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",14,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",15,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",16,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",17,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",18,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",45,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",19,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",20,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",46,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",21,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",22,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",23,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",24,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",25,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",26,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",27,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",28,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",43,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",44,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",42,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",47,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",48,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",4,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",30,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs::adapter","",32,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",33,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs","",34,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs::mock","",35,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::rngs","",54,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",55,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",56,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::seq::index","",36,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",58,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",59,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::seq","",57,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand::distributions","",5,[[["formatter"],["self"]],["result"]]],[11,"description","","",5,[[["self"]],["str"]]],[11,"cause","","",5,[[["self"]],[["error"],["option",["error"]]]]],[11,"next_u32","rand::rngs::adapter","",32,[[["self"]],["u32"]]],[11,"next_u64","","",32,[[["self"]],["u64"]]],[11,"fill_bytes","","",32,[[["self"]]]],[11,"try_fill_bytes","","",32,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",33,[[["self"]],["u32"]]],[11,"next_u64","","",33,[[["self"]],["u64"]]],[11,"fill_bytes","","",33,[[["self"]]]],[11,"try_fill_bytes","","",33,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs","",34,[[["self"]],["u32"]]],[11,"next_u64","","",34,[[["self"]],["u64"]]],[11,"fill_bytes","","",34,[[["self"]]]],[11,"try_fill_bytes","","",34,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs::mock","",35,[[["self"]],["u32"]]],[11,"next_u64","","",35,[[["self"]],["u64"]]],[11,"fill_bytes","","",35,[[["self"]]]],[11,"try_fill_bytes","","",35,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","rand::rngs","",54,[[["self"]],["u32"]]],[11,"next_u64","","",54,[[["self"]],["u64"]]],[11,"fill_bytes","","",54,[[["self"]]]],[11,"try_fill_bytes","","",54,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",55,[[["self"]],["u32"]]],[11,"next_u64","","",55,[[["self"]],["u64"]]],[11,"fill_bytes","","",55,[[["self"]]]],[11,"try_fill_bytes","","",55,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",56,[[["self"]],["u32"]]],[11,"next_u64","","",56,[[["self"]],["u64"]]],[11,"fill_bytes","","",56,[[["self"]]]],[11,"try_fill_bytes","","",56,[[["self"]],[["result",["error"]],["error"]]]],[11,"from_seed","","",54,[[],["self"]]],[11,"from_rng","","",54,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"from_seed","","",55,[[],["self"]]],[11,"from_rng","","",55,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"should_retry","rand","True if this kind of error may resolve itself on retry.",2,[[],["bool"]]],[11,"should_wait","","True if we should retry but wait before retrying",2,[[],["bool"]]],[11,"description","","A description of this error kind",2,[[],["str"]]],[11,"new","","Create a new instance, with specified kind and a message.",3,[[["errorkind"],["str"]],["error"]]],[11,"with_cause","","Create a new instance, with specified kind, message, and a…",3,[[["errorkind"],["str"],["e"]],["error"]]],[11,"take_cause","","Take the cause, if any. This allows the embedded cause to…",3,[[["self"]],[["box",["error"]],["option",["box"]]]]],[11,"new","rand::rngs","Create a new `JitterRng`. Makes use of `std::time` for a…",52,[[],[["result",["jitterrng","timererror"]],["timererror"],["jitterrng"]]]],[11,"new_with_timer","","Create a new `JitterRng`. A custom timer can be supplied,…",52,[[],["jitterrng"]]],[11,"set_rounds","","Configures how many rounds are used to generate each…",52,[[["self"],["u8"]]]],[11,"test_timer","","Basic quality tests on the timer, by measuring CPU timing…",52,[[["self"]],[["timererror"],["result",["u8","timererror"]],["u8"]]]],[11,"timer_stats","","Statistical test: return the timer delta of one normal run…",52,[[["self"],["bool"]],["i64"]]],[11,"new","","Create a new `OsRng`.",53,[[],[["result",["osrng","error"]],["error"],["osrng"]]]]],"p":[[8,"RngCore"],[8,"SeedableRng"],[4,"ErrorKind"],[3,"Error"],[3,"Weighted"],[4,"WeightedError"],[8,"SampleUniform"],[8,"UniformSampler"],[8,"SampleBorrow"],[3,"Uniform"],[3,"Bernoulli"],[3,"WeightedIndex"],[3,"UnitSphereSurface"],[3,"UnitCircle"],[3,"Gamma"],[3,"ChiSquared"],[3,"FisherF"],[3,"StudentT"],[3,"Beta"],[3,"Normal"],[3,"LogNormal"],[3,"Exp"],[3,"Pareto"],[3,"Poisson"],[3,"Binomial"],[3,"Cauchy"],[3,"Dirichlet"],[3,"Triangular"],[3,"Weibull"],[8,"Distribution"],[3,"WeightedChoice"],[4,"TimerError"],[3,"ReadRng"],[3,"ReseedingRng"],[3,"EntropyRng"],[3,"StepRng"],[4,"IndexVec"],[8,"SliceRandom"],[8,"IteratorRandom"],[8,"Rng"],[8,"AsByteSliceMut"],[8,"FromEntropy"],[3,"Alphanumeric"],[3,"OpenClosed01"],[3,"Open01"],[3,"StandardNormal"],[3,"Exp1"],[3,"DistIter"],[3,"Standard"],[3,"UniformInt"],[3,"UniformFloat"],[3,"UniformDuration"],[3,"JitterRng"],[3,"OsRng"],[3,"SmallRng"],[3,"StdRng"],[3,"ThreadRng"],[3,"SliceChooseIter"],[4,"IndexVecIter"],[4,"IndexVecIntoIter"]]}; searchIndex["rand_chacha"] = {"doc":"The ChaCha random number generator.","i":[[3,"ChaCha12Core","rand_chacha","ChaCha with 12 rounds",null,null],[3,"ChaCha12Rng","","A cryptographically secure random number generator that…",null,null],[3,"ChaCha20Core","","ChaCha with 20 rounds",null,null],[3,"ChaCha20Rng","","A cryptographically secure random number generator that…",null,null],[3,"ChaCha8Core","","ChaCha with 8 rounds",null,null],[3,"ChaCha8Rng","","A cryptographically secure random number generator that…",null,null],[11,"get_word_pos","","Get the offset from the start of the stream, in 32-bit…",0,[[["self"]],["u128"]]],[11,"set_word_pos","","Set the offset from the start of the stream, in 32-bit…",0,[[["self"],["u128"]]]],[11,"set_stream","","Set the stream number.",0,[[["self"],["u64"]]]],[11,"get_word_pos","","Get the offset from the start of the stream, in 32-bit…",1,[[["self"]],["u128"]]],[11,"set_word_pos","","Set the offset from the start of the stream, in 32-bit…",1,[[["self"],["u128"]]]],[11,"set_stream","","Set the stream number.",1,[[["self"],["u64"]]]],[11,"get_word_pos","","Get the offset from the start of the stream, in 32-bit…",2,[[["self"]],["u128"]]],[11,"set_word_pos","","Set the offset from the start of the stream, in 32-bit…",2,[[["self"],["u128"]]]],[11,"set_stream","","Set the stream number.",2,[[["self"],["u64"]]]],[6,"ChaChaRng","","ChaCha with 20 rounds",null,null],[6,"ChaChaCore","","ChaCha with 20 rounds, low-level interface",null,null],[11,"from","","",3,[[["t"]],["t"]]],[11,"into","","",3,[[],["u"]]],[11,"to_owned","","",3,[[["self"]],["t"]]],[11,"clone_into","","",3,[[["self"],["t"]]]],[11,"try_from","","",3,[[["u"]],["result"]]],[11,"try_into","","",3,[[],["result"]]],[11,"borrow","","",3,[[["self"]],["t"]]],[11,"borrow_mut","","",3,[[["self"]],["t"]]],[11,"type_id","","",3,[[["self"]],["typeid"]]],[11,"vzip","","",3,[[],["v"]]],[11,"from","","",1,[[["t"]],["t"]]],[11,"into","","",1,[[],["u"]]],[11,"to_owned","","",1,[[["self"]],["t"]]],[11,"clone_into","","",1,[[["self"],["t"]]]],[11,"try_from","","",1,[[["u"]],["result"]]],[11,"try_into","","",1,[[],["result"]]],[11,"borrow","","",1,[[["self"]],["t"]]],[11,"borrow_mut","","",1,[[["self"]],["t"]]],[11,"type_id","","",1,[[["self"]],["typeid"]]],[11,"vzip","","",1,[[],["v"]]],[11,"from","","",4,[[["t"]],["t"]]],[11,"into","","",4,[[],["u"]]],[11,"to_owned","","",4,[[["self"]],["t"]]],[11,"clone_into","","",4,[[["self"],["t"]]]],[11,"try_from","","",4,[[["u"]],["result"]]],[11,"try_into","","",4,[[],["result"]]],[11,"borrow","","",4,[[["self"]],["t"]]],[11,"borrow_mut","","",4,[[["self"]],["t"]]],[11,"type_id","","",4,[[["self"]],["typeid"]]],[11,"vzip","","",4,[[],["v"]]],[11,"from","","",0,[[["t"]],["t"]]],[11,"into","","",0,[[],["u"]]],[11,"to_owned","","",0,[[["self"]],["t"]]],[11,"clone_into","","",0,[[["self"],["t"]]]],[11,"try_from","","",0,[[["u"]],["result"]]],[11,"try_into","","",0,[[],["result"]]],[11,"borrow","","",0,[[["self"]],["t"]]],[11,"borrow_mut","","",0,[[["self"]],["t"]]],[11,"type_id","","",0,[[["self"]],["typeid"]]],[11,"vzip","","",0,[[],["v"]]],[11,"from","","",5,[[["t"]],["t"]]],[11,"into","","",5,[[],["u"]]],[11,"to_owned","","",5,[[["self"]],["t"]]],[11,"clone_into","","",5,[[["self"],["t"]]]],[11,"try_from","","",5,[[["u"]],["result"]]],[11,"try_into","","",5,[[],["result"]]],[11,"borrow","","",5,[[["self"]],["t"]]],[11,"borrow_mut","","",5,[[["self"]],["t"]]],[11,"type_id","","",5,[[["self"]],["typeid"]]],[11,"vzip","","",5,[[],["v"]]],[11,"from","","",2,[[["t"]],["t"]]],[11,"into","","",2,[[],["u"]]],[11,"to_owned","","",2,[[["self"]],["t"]]],[11,"clone_into","","",2,[[["self"],["t"]]]],[11,"try_from","","",2,[[["u"]],["result"]]],[11,"try_into","","",2,[[],["result"]]],[11,"borrow","","",2,[[["self"]],["t"]]],[11,"borrow_mut","","",2,[[["self"]],["t"]]],[11,"type_id","","",2,[[["self"]],["typeid"]]],[11,"vzip","","",2,[[],["v"]]],[11,"from","","",0,[[["chacha20core"]],["self"]]],[11,"from","","",1,[[["chacha12core"]],["self"]]],[11,"from","","",2,[[["chacha8core"]],["self"]]],[11,"clone","","",4,[[["self"]],["chacha20core"]]],[11,"clone","","",0,[[["self"]],["chacha20rng"]]],[11,"clone","","",3,[[["self"]],["chacha12core"]]],[11,"clone","","",1,[[["self"]],["chacha12rng"]]],[11,"clone","","",5,[[["self"]],["chacha8core"]]],[11,"clone","","",2,[[["self"]],["chacha8rng"]]],[11,"fmt","","",4,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",0,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",3,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",1,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",5,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",2,[[["formatter"],["self"]],["result"]]],[11,"generate","","",4,[[["self"]]]],[11,"generate","","",3,[[["self"]]]],[11,"generate","","",5,[[["self"]]]],[11,"next_u32","","",0,[[["self"]],["u32"]]],[11,"next_u64","","",0,[[["self"]],["u64"]]],[11,"fill_bytes","","",0,[[["self"]]]],[11,"try_fill_bytes","","",0,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",1,[[["self"]],["u32"]]],[11,"next_u64","","",1,[[["self"]],["u64"]]],[11,"fill_bytes","","",1,[[["self"]]]],[11,"try_fill_bytes","","",1,[[["self"]],[["result",["error"]],["error"]]]],[11,"next_u32","","",2,[[["self"]],["u32"]]],[11,"next_u64","","",2,[[["self"]],["u64"]]],[11,"fill_bytes","","",2,[[["self"]]]],[11,"try_fill_bytes","","",2,[[["self"]],[["result",["error"]],["error"]]]],[11,"from_seed","","",4,[[],["self"]]],[11,"from_seed","","",0,[[],["self"]]],[11,"from_seed","","",3,[[],["self"]]],[11,"from_seed","","",1,[[],["self"]]],[11,"from_seed","","",5,[[],["self"]]],[11,"from_seed","","",2,[[],["self"]]]],"p":[[3,"ChaCha20Rng"],[3,"ChaCha12Rng"],[3,"ChaCha8Rng"],[3,"ChaCha12Core"],[3,"ChaCha20Core"],[3,"ChaCha8Core"]]}; searchIndex["rand_core"] = {"doc":"Random number generation traits","i":[[3,"Error","rand_core","Error type of random number generators",null,null],[3,"OsRng","","A random number generator that retrieves randomness from…",null,null],[11,"new","","Construct from any type supporting `std::error::Error`",0,[[["e"]],["self"]]],[11,"inner","","Reference the inner error (`std` only)",0,[[["self"]],["error"]]],[11,"take_inner","","Unwrap the inner error (`std` only)",0,[[],[["box",["error"]],["error"]]]],[18,"INTERNAL_START","","Codes below this point represent OS Errors (i.e. positive…",0,null],[18,"CUSTOM_START","","Codes at or above this point can be used by users to…",0,null],[11,"raw_os_error","","Extract the raw OS error code (if this error came from the…",0,[[["self"]],[["option",["i32"]],["i32"]]]],[11,"code","","Retrieve the error code, if any.",0,[[["self"]],[["nonzerou32"],["option",["nonzerou32"]]]]],[0,"block","","The `BlockRngCore` trait and implementation helpers",null,null],[3,"BlockRng","rand_core::block","A wrapper type implementing [`RngCore`] for some type…",null,null],[12,"core","","The core part of the RNG, implementing the `generate`…",1,null],[3,"BlockRng64","","A wrapper type implementing [`RngCore`] for some type…",null,null],[12,"core","","The core part of the RNG, implementing the `generate`…",2,null],[8,"BlockRngCore","","A trait for RNGs which do not generate random numbers…",null,null],[16,"Item","","Results element type, e.g. `u32`.",3,null],[16,"Results","","Results type. This is the 'block' an RNG implementing…",3,null],[10,"generate","","Generate a new block of results.",3,[[["self"]]]],[11,"new","","Create a new `BlockRng` from an existing RNG implementing…",1,[[["r"]],["blockrng"]]],[11,"index","","Get the index into the result buffer.",1,[[["self"]],["usize"]]],[11,"reset","","Reset the number of available results. This will force a…",1,[[["self"]]]],[11,"generate_and_set","","Generate a new set of results immediately, setting the…",1,[[["self"],["usize"]]]],[11,"new","","Create a new `BlockRng` from an existing RNG implementing…",2,[[["r"]],["blockrng64"]]],[11,"index","","Get the index into the result buffer.",2,[[["self"]],["usize"]]],[11,"reset","","Reset the number of available results. This will force a…",2,[[["self"]]]],[11,"generate_and_set","","Generate a new set of results immediately, setting the…",2,[[["self"],["usize"]]]],[0,"impls","rand_core","Helper functions for implementing `RngCore` functions.",null,null],[5,"next_u64_via_u32","rand_core::impls","Implement `next_u64` via `next_u32`, little-endian order.",null,[[["r"]],["u64"]]],[5,"fill_bytes_via_next","","Implement `fill_bytes` via `next_u64` and `next_u32`,…",null,[[["r"]]]],[5,"fill_via_u32_chunks","","Implement `fill_bytes` by reading chunks from the output…",null,[[]]],[5,"fill_via_u64_chunks","","Implement `fill_bytes` by reading chunks from the output…",null,[[]]],[5,"next_u32_via_fill","","Implement `next_u32` via `fill_bytes`, little-endian order.",null,[[["r"]],["u32"]]],[5,"next_u64_via_fill","","Implement `next_u64` via `fill_bytes`, little-endian order.",null,[[["r"]],["u64"]]],[0,"le","rand_core","Little-Endian utilities",null,null],[5,"read_u32_into","rand_core::le","Reads unsigned 32 bit integers from `src` into `dst`.…",null,[[]]],[5,"read_u64_into","","Reads unsigned 64 bit integers from `src` into `dst`.…",null,[[]]],[8,"RngCore","rand_core","The core of a random number generator.",null,null],[10,"next_u32","","Return the next random `u32`.",4,[[["self"]],["u32"]]],[10,"next_u64","","Return the next random `u64`.",4,[[["self"]],["u64"]]],[10,"fill_bytes","","Fill `dest` with random data.",4,[[["self"]]]],[10,"try_fill_bytes","","Fill `dest` entirely with random data.",4,[[["self"]],[["error"],["result",["error"]]]]],[8,"CryptoRng","","A marker trait used to indicate that an [`RngCore`] or…",null,null],[8,"SeedableRng","","A random number generator that can be explicitly seeded.",null,null],[16,"Seed","","Seed type, which is restricted to types…",5,null],[10,"from_seed","","Create a new PRNG using the given seed.",5,[[],["self"]]],[11,"seed_from_u64","","Create a new PRNG using a `u64` seed.",5,[[["u64"]],["self"]]],[11,"from_rng","","Create a new PRNG seeded from another `Rng`.",5,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"from_entropy","","Creates a new instance of the RNG seeded via [`getrandom`].",5,[[],["self"]]],[11,"from","","",0,[[["t"]],["t"]]],[11,"into","","",0,[[],["u"]]],[11,"to_string","","",0,[[["self"]],["string"]]],[11,"try_from","","",0,[[["u"]],["result"]]],[11,"try_into","","",0,[[],["result"]]],[11,"borrow","","",0,[[["self"]],["t"]]],[11,"borrow_mut","","",0,[[["self"]],["t"]]],[11,"type_id","","",0,[[["self"]],["typeid"]]],[11,"from","","",6,[[["t"]],["t"]]],[11,"into","","",6,[[],["u"]]],[11,"to_owned","","",6,[[["self"]],["t"]]],[11,"clone_into","","",6,[[["self"],["t"]]]],[11,"try_from","","",6,[[["u"]],["result"]]],[11,"try_into","","",6,[[],["result"]]],[11,"borrow","","",6,[[["self"]],["t"]]],[11,"borrow_mut","","",6,[[["self"]],["t"]]],[11,"type_id","","",6,[[["self"]],["typeid"]]],[11,"from","rand_core::block","",1,[[["t"]],["t"]]],[11,"into","","",1,[[],["u"]]],[11,"to_owned","","",1,[[["self"]],["t"]]],[11,"clone_into","","",1,[[["self"],["t"]]]],[11,"try_from","","",1,[[["u"]],["result"]]],[11,"try_into","","",1,[[],["result"]]],[11,"borrow","","",1,[[["self"]],["t"]]],[11,"borrow_mut","","",1,[[["self"]],["t"]]],[11,"type_id","","",1,[[["self"]],["typeid"]]],[11,"from","","",2,[[["t"]],["t"]]],[11,"into","","",2,[[],["u"]]],[11,"to_owned","","",2,[[["self"]],["t"]]],[11,"clone_into","","",2,[[["self"],["t"]]]],[11,"try_from","","",2,[[["u"]],["result"]]],[11,"try_into","","",2,[[],["result"]]],[11,"borrow","","",2,[[["self"]],["t"]]],[11,"borrow_mut","","",2,[[["self"]],["t"]]],[11,"type_id","","",2,[[["self"]],["typeid"]]],[11,"next_u32","","",1,[[["self"]],["u32"]]],[11,"next_u64","","",1,[[["self"]],["u64"]]],[11,"fill_bytes","","",1,[[["self"]]]],[11,"try_fill_bytes","","",1,[[["self"]],[["error"],["result",["error"]]]]],[11,"next_u32","","",2,[[["self"]],["u32"]]],[11,"next_u64","","",2,[[["self"]],["u64"]]],[11,"fill_bytes","","",2,[[["self"]]]],[11,"try_fill_bytes","","",2,[[["self"]],[["error"],["result",["error"]]]]],[11,"next_u32","rand_core","",6,[[["self"]],["u32"]]],[11,"next_u64","","",6,[[["self"]],["u64"]]],[11,"fill_bytes","","",6,[[["self"]]]],[11,"try_fill_bytes","","",6,[[["self"]],[["error"],["result",["error"]]]]],[11,"from_seed","rand_core::block","",1,[[],["self"]]],[11,"seed_from_u64","","",1,[[["u64"]],["self"]]],[11,"from_rng","","",1,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"from_seed","","",2,[[],["self"]]],[11,"seed_from_u64","","",2,[[["u64"]],["self"]]],[11,"from_rng","","",2,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"from","rand_core","",0,[[["nonzerou32"]],["self"]]],[11,"from","","",0,[[["error"]],["self"]]],[11,"clone","rand_core::block","",1,[[["self"]],["blockrng"]]],[11,"clone","","",2,[[["self"]],["blockrng64"]]],[11,"clone","rand_core","",6,[[["self"]],["osrng"]]],[11,"default","","",6,[[],["osrng"]]],[11,"fmt","","",0,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand_core::block","",1,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",2,[[["formatter"],["self"]],["result"]]],[11,"fmt","rand_core","",6,[[["formatter"],["self"]],["result"]]],[11,"fmt","","",0,[[["formatter"],["self"]],["result"]]],[11,"source","","",0,[[["self"]],[["error"],["option",["error"]]]]],[11,"read","","",4,[[["self"]],[["error"],["result",["usize","error"]],["usize"]]]]],"p":[[3,"Error"],[3,"BlockRng"],[3,"BlockRng64"],[8,"BlockRngCore"],[8,"RngCore"],[8,"SeedableRng"],[3,"OsRng"]]}; searchIndex["rand_hc"] = {"doc":"The HC128 random number generator.","i":[[3,"Hc128Rng","rand_hc","A cryptographically secure random number generator that…",null,null],[3,"Hc128Core","","The core of `Hc128Rng`, used with `BlockRng`.",null,null],[11,"from","","",0,[[["t"]],["t"]]],[11,"try_from","","",0,[[["u"]],["result"]]],[11,"into","","",0,[[],["u"]]],[11,"try_into","","",0,[[],["result"]]],[11,"borrow","","",0,[[["self"]],["t"]]],[11,"borrow_mut","","",0,[[["self"]],["t"]]],[11,"type_id","","",0,[[["self"]],["typeid"]]],[11,"to_owned","","",0,[[["self"]],["t"]]],[11,"clone_into","","",0,[[["self"],["t"]]]],[11,"from","","",1,[[["t"]],["t"]]],[11,"try_from","","",1,[[["u"]],["result"]]],[11,"into","","",1,[[],["u"]]],[11,"try_into","","",1,[[],["result"]]],[11,"borrow","","",1,[[["self"]],["t"]]],[11,"borrow_mut","","",1,[[["self"]],["t"]]],[11,"type_id","","",1,[[["self"]],["typeid"]]],[11,"to_owned","","",1,[[["self"]],["t"]]],[11,"clone_into","","",1,[[["self"],["t"]]]],[11,"fmt","","",0,[[["self"],["formatter"]],["result"]]],[11,"fmt","","",1,[[["self"],["formatter"]],["result"]]],[11,"clone","","",0,[[["self"]],["hc128rng"]]],[11,"clone","","",1,[[["self"]],["hc128core"]]],[11,"generate","","",1,[[["self"]]]],[11,"next_u32","","",0,[[["self"]],["u32"]]],[11,"next_u64","","",0,[[["self"]],["u64"]]],[11,"fill_bytes","","",0,[[["self"]]]],[11,"try_fill_bytes","","",0,[[["self"]],[["error"],["result",["error"]]]]],[11,"from_seed","","",0,[[],["self"]]],[11,"from_rng","","",0,[[["rngcore"]],[["result",["error"]],["error"]]]],[11,"from_seed","","Create an HC-128 random number generator with a seed. The…",1,[[],["self"]]]],"p":[[3,"Hc128Rng"],[3,"Hc128Core"]]}; diff --git a/source-files.js b/source-files.js index 171a388..99ed4d6 100644 --- a/source-files.js +++ b/source-files.js @@ -98,7 +98,7 @@ sourcesIndex["proc_macro2"] = {"name":"","files":["fallback.rs","lib.rs","strnom sourcesIndex["proc_macro_hack"] = {"name":"","files":["error.rs","lib.rs","parse.rs","quote.rs"]}; sourcesIndex["quick_error"] = {"name":"","files":["lib.rs"]}; sourcesIndex["quote"] = {"name":"","files":["ext.rs","lib.rs","runtime.rs","to_tokens.rs"]}; -sourcesIndex["rand"] = {"name":"","dirs":[{"name":"distributions","dirs":[{"name":"weighted","files":["alias_method.rs","mod.rs"]}],"files":["bernoulli.rs","binomial.rs","cauchy.rs","dirichlet.rs","exponential.rs","float.rs","gamma.rs","integer.rs","mod.rs","normal.rs","other.rs","pareto.rs","poisson.rs","triangular.rs","uniform.rs","unit_circle.rs","unit_sphere.rs","utils.rs","weibull.rs","ziggurat_tables.rs"]},{"name":"rngs","dirs":[{"name":"adapter","files":["mod.rs","read.rs","reseeding.rs"]}],"files":["entropy.rs","mock.rs","mod.rs","std.rs","thread.rs"]},{"name":"seq","files":["index.rs","mod.rs"]}],"files":["lib.rs","prelude.rs"]}; +sourcesIndex["rand"] = {"name":"","dirs":[{"name":"distributions","files":["bernoulli.rs","binomial.rs","cauchy.rs","dirichlet.rs","exponential.rs","float.rs","gamma.rs","integer.rs","mod.rs","normal.rs","other.rs","pareto.rs","poisson.rs","triangular.rs","uniform.rs","unit_circle.rs","unit_sphere.rs","utils.rs","weibull.rs","weighted.rs","ziggurat_tables.rs"]},{"name":"prng","files":["mod.rs"]},{"name":"rngs","dirs":[{"name":"adapter","files":["mod.rs","read.rs","reseeding.rs"]}],"files":["entropy.rs","mock.rs","mod.rs","small.rs","std.rs","thread.rs"]},{"name":"seq","files":["index.rs","mod.rs"]}],"files":["deprecated.rs","lib.rs","prelude.rs"]}; sourcesIndex["rand_chacha"] = {"name":"","files":["chacha.rs","guts.rs","lib.rs"]}; sourcesIndex["rand_core"] = {"name":"","files":["block.rs","error.rs","impls.rs","le.rs","lib.rs","os.rs"]}; sourcesIndex["rand_hc"] = {"name":"","files":["hc128.rs","lib.rs"]}; diff --git a/src/rand/distributions/bernoulli.rs.html b/src/rand/distributions/bernoulli.rs.html index e913bb9..91be926 100644 --- a/src/rand/distributions/bernoulli.rs.html +++ b/src/rand/distributions/bernoulli.rs.html @@ -1,4 +1,4 @@ -bernoulli.rs.html -- source
  1
+bernoulli.rs.html -- source
  1
   2
   3
   4
@@ -163,40 +163,6 @@
 163
 164
 165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -208,9 +174,8 @@
 
 //! The Bernoulli distribution.
 
-use crate::distributions::Distribution;
-use crate::Rng;
-use core::{fmt, u64};
+use Rng;
+use distributions::Distribution;
 
 /// The Bernoulli distribution.
 ///
@@ -221,7 +186,7 @@
 /// ```rust
 /// use rand::distributions::{Bernoulli, Distribution};
 ///
-/// let d = Bernoulli::new(0.3).unwrap();
+/// let d = Bernoulli::new(0.3);
 /// let v = d.sample(&mut rand::thread_rng());
 /// println!("{} is from a Bernoulli distribution", v);
 /// ```
@@ -256,33 +221,19 @@
 // the RNG, and pay the performance price for all uses that *are* reasonable.
 // Luckily, if `new()` and `sample` are close, the compiler can optimize out the
 // extra check.
-const ALWAYS_TRUE: u64 = u64::MAX;
+const ALWAYS_TRUE: u64 = ::core::u64::MAX;
 
 // This is just `2.0.powi(64)`, but written this way because it is not available
 // in `no_std` mode.
 const SCALE: f64 = 2.0 * (1u64 << 63) as f64;
 
-/// Error type returned from `Bernoulli::new`.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum BernoulliError {
-    /// `p < 0` or `p > 1`.
-    InvalidProbability,
-}
-
-impl fmt::Display for BernoulliError {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(match self {
-            BernoulliError::InvalidProbability => "p is outside [0, 1] in Bernoulli distribution",
-        })
-    }
-}
-
-#[cfg(feature = "std")]
-impl ::std::error::Error for BernoulliError {}
-
 impl Bernoulli {
     /// Construct a new `Bernoulli` with the given probability of success `p`.
     ///
+    /// # Panics
+    ///
+    /// If `p < 0` or `p > 1`.
+    ///
     /// # Precision
     ///
     /// For `p = 1.0`, the resulting distribution will always generate true.
@@ -292,36 +243,33 @@
     /// a multiple of 2<sup>-64</sup>. (Note that not all multiples of
     /// 2<sup>-64</sup> in `[0, 1]` can be represented as a `f64`.)
     #[inline]
-    pub fn new(p: f64) -> Result<Bernoulli, BernoulliError> {
-        if !(p >= 0.0 && p < 1.0) {
-            if p == 1.0 {
-                return Ok(Bernoulli { p_int: ALWAYS_TRUE });
-            }
-            return Err(BernoulliError::InvalidProbability);
+    pub fn new(p: f64) -> Bernoulli {
+        if p < 0.0 || p >= 1.0 {
+            if p == 1.0 { return Bernoulli { p_int: ALWAYS_TRUE } }
+            panic!("Bernoulli::new not called with 0.0 <= p <= 1.0");
         }
-        Ok(Bernoulli {
-            p_int: (p * SCALE) as u64,
-        })
+        Bernoulli { p_int: (p * SCALE) as u64 }
     }
 
     /// Construct a new `Bernoulli` with the probability of success of
     /// `numerator`-in-`denominator`. I.e. `new_ratio(2, 3)` will return
     /// a `Bernoulli` with a 2-in-3 chance, or about 67%, of returning `true`.
     ///
+    /// If `numerator == denominator` then the returned `Bernoulli` will always
     /// return `true`. If `numerator == 0` it will always return `false`.
-    /// For `numerator > denominator` and `denominator == 0`, this returns an
-    /// error. Otherwise, for `numerator == denominator`, samples are always
-    /// true; for `numerator == 0` samples are always false.
+    ///
+    /// # Panics
+    ///
+    /// If `denominator == 0` or `numerator > denominator`.
+    ///
     #[inline]
-    pub fn from_ratio(numerator: u32, denominator: u32) -> Result<Bernoulli, BernoulliError> {
-        if numerator > denominator || denominator == 0 {
-            return Err(BernoulliError::InvalidProbability);
-        }
+    pub fn from_ratio(numerator: u32, denominator: u32) -> Bernoulli {
+        assert!(numerator <= denominator);
         if numerator == denominator {
-            return Ok(Bernoulli { p_int: ALWAYS_TRUE });
+            return Bernoulli { p_int: ::core::u64::MAX }
         }
-        let p_int = ((f64::from(numerator) / f64::from(denominator)) * SCALE) as u64;
-        Ok(Bernoulli { p_int })
+        let p_int = ((numerator as f64 / denominator as f64) * SCALE) as u64;
+        Bernoulli { p_int }
     }
 }
 
@@ -329,9 +277,7 @@
     #[inline]
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> bool {
         // Make sure to always return true for p = 1.0.
-        if self.p_int == ALWAYS_TRUE {
-            return true;
-        }
+        if self.p_int == ALWAYS_TRUE { return true; }
         let v: u64 = rng.gen();
         v < self.p_int
     }
@@ -339,15 +285,15 @@
 
 #[cfg(test)]
 mod test {
+    use Rng;
+    use distributions::Distribution;
     use super::Bernoulli;
-    use crate::distributions::Distribution;
-    use crate::Rng;
 
     #[test]
     fn test_trivial() {
-        let mut r = crate::test::rng(1);
-        let always_false = Bernoulli::new(0.0).unwrap();
-        let always_true = Bernoulli::new(1.0).unwrap();
+        let mut r = ::test::rng(1);
+        let always_false = Bernoulli::new(0.0);
+        let always_true = Bernoulli::new(1.0);
         for _ in 0..5 {
             assert_eq!(r.sample::<bool, _>(&always_false), false);
             assert_eq!(r.sample::<bool, _>(&always_true), true);
@@ -357,18 +303,17 @@
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_average() {
         const P: f64 = 0.3;
         const NUM: u32 = 3;
         const DENOM: u32 = 10;
-        let d1 = Bernoulli::new(P).unwrap();
-        let d2 = Bernoulli::from_ratio(NUM, DENOM).unwrap();
+        let d1 = Bernoulli::new(P);
+        let d2 = Bernoulli::from_ratio(NUM, DENOM);
         const N: u32 = 100_000;
 
         let mut sum1: u32 = 0;
         let mut sum2: u32 = 0;
-        let mut rng = crate::test::rng(2);
+        let mut rng = ::test::rng(2);
         for _ in 0..N {
             if d1.sample(&mut rng) {
                 sum1 += 1;
@@ -381,20 +326,7 @@
         assert!((avg1 - P).abs() < 5e-3);
 
         let avg2 = (sum2 as f64) / (N as f64);
-        assert!((avg2 - (NUM as f64) / (DENOM as f64)).abs() < 5e-3);
-    }
-
-    #[test]
-    fn value_stability() {
-        let mut rng = crate::test::rng(3);
-        let distr = Bernoulli::new(0.4532).unwrap();
-        let mut buf = [false; 10];
-        for x in &mut buf {
-            *x = rng.sample(&distr);
-        }
-        assert_eq!(buf, [
-            true, false, false, true, false, false, true, true, true, true
-        ]);
+        assert!((avg2 - (NUM as f64)/(DENOM as f64)).abs() < 5e-3);
     }
 }
 
diff --git a/src/rand/distributions/binomial.rs.html b/src/rand/distributions/binomial.rs.html index 98f05d7..44a65f5 100644 --- a/src/rand/distributions/binomial.rs.html +++ b/src/rand/distributions/binomial.rs.html @@ -1,4 +1,4 @@ -binomial.rs.html -- source
  1
+binomial.rs.html -- source
  1
   2
   3
   4
@@ -175,150 +175,6 @@
 175
 176
 177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
-292
-293
-294
-295
-296
-297
-298
-299
-300
-301
-302
-303
-304
-305
-306
-307
-308
-309
-310
-311
-312
-313
-314
-315
-316
-317
-318
-319
-320
-321
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2016-2017 The Rust Project Developers.
@@ -330,17 +186,25 @@
 // except according to those terms.
 
 //! The binomial distribution.
-#![allow(deprecated)]
-#![allow(clippy::all)]
 
-use crate::distributions::{Distribution, Uniform};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, Bernoulli, Cauchy};
+use distributions::utils::log_gamma;
 
 /// The binomial distribution `Binomial(n, p)`.
 ///
 /// This distribution has density function:
 /// `f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k)` for `k >= 0`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Binomial, Distribution};
+///
+/// let bin = Binomial::new(20, 0.3);
+/// let v = bin.sample(&mut rand::thread_rng());
+/// println!("{} is from a binomial distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Binomial {
     /// Number of trials.
@@ -361,13 +225,6 @@
     }
 }
 
-/// Convert a `f64` to an `i64`, panicing on overflow.
-// In the future (Rust 1.34), this might be replaced with `TryFrom`.
-fn f64_to_i64(x: f64) -> i64 {
-    assert!(x < (::std::i64::MAX as f64));
-    x as i64
-}
-
 impl Distribution<u64> for Binomial {
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> u64 {
         // Handle these values directly.
@@ -376,217 +233,84 @@
         } else if self.p == 1.0 {
             return self.n;
         }
-
-        // The binomial distribution is symmetrical with respect to p -> 1-p,
-        // k -> n-k switch p so that it is less than 0.5 - this allows for lower
-        // expected values we will just invert the result at the end
-        let p = if self.p <= 0.5 { self.p } else { 1.0 - self.p };
-
-        let result;
-        let q = 1. - p;
-
-        // For small n * min(p, 1 - p), the BINV algorithm based on the inverse
-        // transformation of the binomial distribution is efficient. Otherwise,
-        // the BTPE algorithm is used.
-        //
-        // Voratas Kachitvichyanukul and Bruce W. Schmeiser. 1988. 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,
-        // Ranlib uses 30, and GSL uses 14.
-        const BINV_THRESHOLD: f64 = 10.;
-
-        if (self.n as f64) * p < BINV_THRESHOLD && self.n <= (::std::i32::MAX as u64) {
-            // Use the BINV algorithm.
-            let s = p / q;
-            let a = ((self.n + 1) as f64) * s;
-            let mut r = q.powi(self.n as i32);
-            let mut u: f64 = rng.gen();
-            let mut x = 0;
-            while u > r as f64 {
-                u -= r;
-                x += 1;
-                r *= a / (x as f64) - s;
+        
+        // For low n, it is faster to sample directly. For both methods,
+        // performance is independent of p. On Intel Haswell CPU this method
+        // appears to be faster for approx n < 300.
+        if self.n < 300 {
+            let mut result = 0;
+            let d = Bernoulli::new(self.p);
+            for _ in 0 .. self.n {
+                result += rng.sample(d) as u32;
             }
-            result = x;
+            return result as u64;
+        }
+        
+        // binomial distribution is symmetrical with respect to p -> 1-p, k -> n-k
+        // switch p so that it is less than 0.5 - this allows for lower expected values
+        // we will just invert the result at the end
+        let p = if self.p <= 0.5 {
+            self.p
         } else {
-            // Use the BTPE algorithm.
+            1.0 - self.p
+        };
 
-            // Threshold for using the squeeze algorithm. This can be freely
-            // chosen based on performance. Ranlib and GSL use 20.
-            const SQUEEZE_THRESHOLD: i64 = 20;
+        // prepare some cached values
+        let float_n = self.n as f64;
+        let ln_fact_n = log_gamma(float_n + 1.0);
+        let pc = 1.0 - p;
+        let log_p = p.ln();
+        let log_pc = pc.ln();
+        let expected = self.n as f64 * p;
+        let sq = (expected * (2.0 * pc)).sqrt();
 
-            // Step 0: Calculate constants as functions of `n` and `p`.
-            let n = self.n as f64;
-            let np = n * p;
-            let npq = np * q;
-            let f_m = np + p;
-            let m = f64_to_i64(f_m);
-            // radius of triangle region, since height=1 also area of region
-            let p1 = (2.195 * npq.sqrt() - 4.6 * q).floor() + 0.5;
-            // tip of triangle
-            let x_m = (m as f64) + 0.5;
-            // left edge of triangle
-            let x_l = x_m - p1;
-            // right edge of triangle
-            let x_r = x_m + p1;
-            let c = 0.134 + 20.5 / (15.3 + (m as f64));
-            // p1 + area of parallelogram region
-            let p2 = p1 * (1. + 2. * c);
+        let mut lresult;
 
-            fn lambda(a: f64) -> f64 {
-                a * (1. + 0.5 * a)
+        // we use the Cauchy distribution as the comparison distribution
+        // f(x) ~ 1/(1+x^2)
+        let cauchy = Cauchy::new(0.0, 1.0);
+        loop {
+            let mut comp_dev: f64;
+            loop {
+                // draw from the Cauchy distribution
+                comp_dev = rng.sample(cauchy);
+                // shift the peak of the comparison ditribution
+                lresult = expected + sq * comp_dev;
+                // repeat the drawing until we are in the range of possible values
+                if lresult >= 0.0 && lresult < float_n + 1.0 {
+                    break;
+                }
             }
 
-            let lambda_l = lambda((f_m - x_l) / (f_m - x_l * p));
-            let lambda_r = lambda((x_r - f_m) / (x_r * q));
-            // p1 + area of left tail
-            let p3 = p2 + c / lambda_l;
-            // p1 + area of right tail
-            let p4 = p3 + c / lambda_r;
+            // the result should be discrete
+            lresult = lresult.floor();
 
-            // return value
-            let mut y: i64;
-
-            let gen_u = Uniform::new(0., p4);
-            let gen_v = Uniform::new(0., 1.);
-
-            loop {
-                // Step 1: Generate `u` for selecting the region. If region 1 is
-                // selected, generate a triangularly distributed variate.
-                let u = gen_u.sample(rng);
-                let mut v = gen_v.sample(rng);
-                if !(u > p1) {
-                    y = f64_to_i64(x_m - p1 * v + u);
-                    break;
-                }
-
-                if !(u > p2) {
-                    // Step 2: Region 2, parallelograms. Check if region 2 is
-                    // used. If so, generate `y`.
-                    let x = x_l + (u - p1) / c;
-                    v = v * c + 1.0 - (x - x_m).abs() / p1;
-                    if v > 1. {
-                        continue;
-                    } else {
-                        y = f64_to_i64(x);
-                    }
-                } else if !(u > p3) {
-                    // Step 3: Region 3, left exponential tail.
-                    y = f64_to_i64(x_l + v.ln() / lambda_l);
-                    if y < 0 {
-                        continue;
-                    } else {
-                        v *= (u - p2) * lambda_l;
-                    }
-                } else {
-                    // Step 4: Region 4, right exponential tail.
-                    y = f64_to_i64(x_r - v.ln() / lambda_r);
-                    if y > 0 && (y as u64) > self.n {
-                        continue;
-                    } else {
-                        v *= (u - p3) * lambda_r;
-                    }
-                }
-
-                // Step 5: Acceptance/rejection comparison.
-
-                // Step 5.0: Test for appropriate method of evaluating f(y).
-                let k = (y - m).abs();
-                if !(k > SQUEEZE_THRESHOLD && (k as f64) < 0.5 * npq - 1.) {
-                    // Step 5.1: Evaluate f(y) via the recursive relationship. Start the
-                    // search from the mode.
-                    let s = p / q;
-                    let a = s * (n + 1.);
-                    let mut f = 1.0;
-                    if m < y {
-                        let mut i = m;
-                        loop {
-                            i += 1;
-                            f *= a / (i as f64) - s;
-                            if i == y {
-                                break;
-                            }
-                        }
-                    } else if m > y {
-                        let mut i = y;
-                        loop {
-                            i += 1;
-                            f /= a / (i as f64) - s;
-                            if i == m {
-                                break;
-                            }
-                        }
-                    }
-                    if v > f {
-                        continue;
-                    } else {
-                        break;
-                    }
-                }
-
-                // Step 5.2: Squeezing. Check the value of ln(v) againts 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);
-                let t = -0.5 * k * k / npq;
-                let alpha = v.ln();
-                if alpha < t - rho {
-                    break;
-                }
-                if alpha > t + rho {
-                    continue;
-                }
-
-                // Step 5.3: Final acceptance/rejection test.
-                let x1 = (y + 1) as f64;
-                let f1 = (m + 1) as f64;
-                let z = (f64_to_i64(n) + 1 - m) as f64;
-                let w = (f64_to_i64(n) - y + 1) as f64;
-
-                fn stirling(a: f64) -> f64 {
-                    let a2 = a * a;
-                    (13860. - (462. - (132. - (99. - 140. / a2) / a2) / a2) / a2) / a / 166320.
-                }
-
-                if alpha
-                        > x_m * (f1 / x1).ln()
-                        + (n - (m as f64) + 0.5) * (z / w).ln()
-                        + ((y - m) as f64) * (w * p / (x1 * q)).ln()
-                        // We use the signs from the GSL implementation, which are
-                        // different than the ones in the reference. According to
-                        // the GSL authors, the new signs were verified to be
-                        // correct by one of the original designers of the
-                        // algorithm.
-                        + stirling(f1)
-                        + stirling(z)
-                        - stirling(x1)
-                        - stirling(w)
-                {
-                    continue;
-                }
+            let log_binomial_dist = ln_fact_n - log_gamma(lresult+1.0) -
+                log_gamma(float_n - lresult + 1.0) + lresult*log_p + (float_n - lresult)*log_pc;
+            // this is the binomial probability divided by the comparison probability
+            // we will generate a uniform random value and if it is larger than this,
+            // we interpret it as a value falling out of the distribution and repeat
+            let comparison_coeff = (log_binomial_dist.exp() * sq) * (1.2 * (1.0 + comp_dev*comp_dev));
 
+            if comparison_coeff >= rng.gen() {
                 break;
             }
-            assert!(y >= 0);
-            result = y as u64;
         }
 
-        // Invert the result for p < 0.5.
+        // invert the result for p < 0.5
         if p != self.p {
-            self.n - result
+            self.n - lresult as u64
         } else {
-            result
+            lresult as u64
         }
     }
 }
 
 #[cfg(test)]
 mod test {
+    use Rng;
+    use distributions::Distribution;
     use super::Binomial;
-    use crate::distributions::Distribution;
-    use crate::Rng;
 
     fn test_binomial_mean_and_variance<R: Rng>(n: u64, p: f64, rng: &mut R) {
         let binomial = Binomial::new(n, p);
@@ -595,32 +319,20 @@
         let expected_variance = n as f64 * p * (1.0 - p);
 
         let mut results = [0.0; 1000];
-        for i in results.iter_mut() {
-            *i = binomial.sample(rng) as f64;
-        }
+        for i in results.iter_mut() { *i = binomial.sample(rng) as f64; }
 
         let mean = results.iter().sum::<f64>() / results.len() as f64;
-        assert!(
-            (mean as f64 - expected_mean).abs() < expected_mean / 50.0,
-            "mean: {}, expected_mean: {}",
-            mean,
-            expected_mean
-        );
+        assert!((mean as f64 - expected_mean).abs() < expected_mean / 50.0);
 
         let variance =
-            results.iter().map(|x| (x - mean) * (x - mean)).sum::<f64>() / results.len() as f64;
-        assert!(
-            (variance - expected_variance).abs() < expected_variance / 10.0,
-            "variance: {}, expected_variance: {}",
-            variance,
-            expected_variance
-        );
+            results.iter().map(|x| (x - mean) * (x - mean)).sum::<f64>()
+            / results.len() as f64;
+        assert!((variance - expected_variance).abs() < expected_variance / 10.0);
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_binomial() {
-        let mut rng = crate::test::rng(351);
+        let mut rng = ::test::rng(351);
         test_binomial_mean_and_variance(150, 0.1, &mut rng);
         test_binomial_mean_and_variance(70, 0.6, &mut rng);
         test_binomial_mean_and_variance(40, 0.5, &mut rng);
@@ -630,7 +342,7 @@
 
     #[test]
     fn test_binomial_end_points() {
-        let mut rng = crate::test::rng(352);
+        let mut rng = ::test::rng(352);
         assert_eq!(rng.sample(Binomial::new(20, 0.0)), 0);
         assert_eq!(rng.sample(Binomial::new(20, 1.0)), 20);
     }
diff --git a/src/rand/distributions/cauchy.rs.html b/src/rand/distributions/cauchy.rs.html
index 3230350..5669175 100644
--- a/src/rand/distributions/cauchy.rs.html
+++ b/src/rand/distributions/cauchy.rs.html
@@ -1,102 +1,118 @@
-cauchy.rs.html -- source
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
+cauchy.rs.html -- source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2016-2017 The Rust Project Developers.
@@ -108,22 +124,29 @@
 // except according to those terms.
 
 //! The Cauchy distribution.
-#![allow(deprecated)]
-#![allow(clippy::all)]
 
-use crate::distributions::Distribution;
-use crate::Rng;
+use Rng;
+use distributions::Distribution;
 use std::f64::consts::PI;
 
 /// The Cauchy distribution `Cauchy(median, scale)`.
 ///
 /// This distribution has a density function:
 /// `f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))`
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Cauchy, Distribution};
+///
+/// let cau = Cauchy::new(2.0, 5.0);
+/// let v = cau.sample(&mut rand::thread_rng());
+/// println!("{} is from a Cauchy(2, 5) distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Cauchy {
     median: f64,
-    scale: f64,
+    scale: f64
 }
 
 impl Cauchy {
@@ -132,7 +155,10 @@
     /// Panics if `scale <= 0`.
     pub fn new(median: f64, scale: f64) -> Cauchy {
         assert!(scale > 0.0, "Cauchy::new called with scale factor <= 0");
-        Cauchy { median, scale }
+        Cauchy {
+            median,
+            scale
+        }
     }
 }
 
@@ -151,8 +177,8 @@
 
 #[cfg(test)]
 mod test {
+    use distributions::Distribution;
     use super::Cauchy;
-    use crate::distributions::Distribution;
 
     fn median(mut numbers: &mut [f64]) -> f64 {
         sort(&mut numbers);
@@ -165,24 +191,30 @@
     }
 
     #[test]
-    fn test_cauchy_averages() {
-        // NOTE: given that the variance and mean are undefined,
-        // this test does not have any rigorous statistical meaning.
+    fn test_cauchy_median() {
         let cauchy = Cauchy::new(10.0, 5.0);
-        let mut rng = crate::test::rng(123);
+        let mut rng = ::test::rng(123);
         let mut numbers: [f64; 1000] = [0.0; 1000];
-        let mut sum = 0.0;
         for i in 0..1000 {
             numbers[i] = cauchy.sample(&mut rng);
-            sum += numbers[i];
         }
         let median = median(&mut numbers);
         println!("Cauchy median: {}", median);
-        assert!((median - 10.0).abs() < 0.4); // not 100% certain, but probable enough
+        assert!((median - 10.0).abs() < 0.5); // not 100% certain, but probable enough
+    }
+
+    #[test]
+    fn test_cauchy_mean() {
+        let cauchy = Cauchy::new(10.0, 5.0);
+        let mut rng = ::test::rng(123);
+        let mut sum = 0.0;
+        for _ in 0..1000 {
+            sum += cauchy.sample(&mut rng);
+        }
         let mean = sum / 1000.0;
         println!("Cauchy mean: {}", mean);
         // for a Cauchy distribution the mean should not converge
-        assert!((mean - 10.0).abs() > 0.4); // not 100% certain, but probable enough
+        assert!((mean - 10.0).abs() > 0.5); // not 100% certain, but probable enough
     }
 
     #[test]
diff --git a/src/rand/distributions/dirichlet.rs.html b/src/rand/distributions/dirichlet.rs.html
index 4d2779f..9bb89b0 100644
--- a/src/rand/distributions/dirichlet.rs.html
+++ b/src/rand/distributions/dirichlet.rs.html
@@ -1,4 +1,4 @@
-dirichlet.rs.html -- source
  1
+dirichlet.rs.html -- source
  1
   2
   3
   4
@@ -124,6 +124,17 @@
 124
 125
 126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -135,19 +146,28 @@
 // except according to those terms.
 
 //! The dirichlet distribution.
-#![allow(deprecated)]
-#![allow(clippy::all)]
 
-use crate::distributions::gamma::Gamma;
-use crate::distributions::Distribution;
-use crate::Rng;
+use Rng;
+use distributions::Distribution;
+use distributions::gamma::Gamma;
 
 /// The dirichelet distribution `Dirichlet(alpha)`.
 ///
 /// The Dirichlet distribution is a family of continuous multivariate
 /// probability distributions parameterized by a vector alpha of positive reals.
 /// It is a multivariate generalization of the beta distribution.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::prelude::*;
+/// use rand::distributions::Dirichlet;
+///
+/// let dirichlet = Dirichlet::new(vec![1.0, 2.0, 3.0]);
+/// let samples = dirichlet.sample(&mut rand::thread_rng());
+/// println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples);
+/// ```
+
 #[derive(Clone, Debug)]
 pub struct Dirichlet {
     /// Concentration parameters (alpha)
@@ -159,6 +179,7 @@
     ///
     /// # Panics
     /// - if `alpha.len() < 2`
+    ///
     #[inline]
     pub fn new<V: Into<Vec<f64>>>(alpha: V) -> Dirichlet {
         let a = alpha.into();
@@ -175,6 +196,7 @@
     /// # Panics
     /// - if `alpha <= 0.0`
     /// - if `size < 2`
+    ///
     #[inline]
     pub fn new_with_param(alpha: f64, size: usize) -> Dirichlet {
         assert!(alpha > 0.0);
@@ -207,12 +229,12 @@
 #[cfg(test)]
 mod test {
     use super::Dirichlet;
-    use crate::distributions::Distribution;
+    use distributions::Distribution;
 
     #[test]
     fn test_dirichlet() {
         let d = Dirichlet::new(vec![1.0, 2.0, 3.0]);
-        let mut rng = crate::test::rng(221);
+        let mut rng = ::test::rng(221);
         let samples = d.sample(&mut rng);
         let _: Vec<f64> = samples
             .into_iter()
@@ -228,7 +250,7 @@
         let alpha = 0.5f64;
         let size = 2;
         let d = Dirichlet::new_with_param(alpha, size);
-        let mut rng = crate::test::rng(221);
+        let mut rng = ::test::rng(221);
         let samples = d.sample(&mut rng);
         let _: Vec<f64> = samples
             .into_iter()
diff --git a/src/rand/distributions/exponential.rs.html b/src/rand/distributions/exponential.rs.html
index 5d08f6d..1e10f4c 100644
--- a/src/rand/distributions/exponential.rs.html
+++ b/src/rand/distributions/exponential.rs.html
@@ -1,4 +1,4 @@
-exponential.rs.html -- source
  1
+exponential.rs.html -- source
  1
   2
   3
   4
@@ -112,6 +112,16 @@
 112
 113
 114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -123,11 +133,10 @@
 // except according to those terms.
 
 //! The exponential distribution.
-#![allow(deprecated)]
 
-use crate::distributions::utils::ziggurat;
-use crate::distributions::{ziggurat_tables, Distribution};
-use crate::Rng;
+use {Rng};
+use distributions::{ziggurat_tables, Distribution};
+use distributions::utils::ziggurat;
 
 /// Samples floating-point numbers according to the exponential distribution,
 /// with rate parameter `λ = 1`. This is equivalent to `Exp::new(1.0)` or
@@ -143,7 +152,15 @@
 ///       Generate Normal Random Samples*](
 ///       https://www.doornik.com/research/ziggurat.pdf).
 ///       Nuffield College, Oxford
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+/// ```
+/// use rand::prelude::*;
+/// use rand::distributions::Exp1;
+///
+/// let val: f64 = SmallRng::from_entropy().sample(Exp1);
+/// println!("{}", val);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Exp1;
 
@@ -160,14 +177,10 @@
             ziggurat_tables::ZIG_EXP_R - rng.gen::<f64>().ln()
         }
 
-        ziggurat(
-            rng,
-            false,
-            &ziggurat_tables::ZIG_EXP_X,
-            &ziggurat_tables::ZIG_EXP_F,
-            pdf,
-            zero_case,
-        )
+        ziggurat(rng, false,
+                 &ziggurat_tables::ZIG_EXP_X,
+                 &ziggurat_tables::ZIG_EXP_F,
+                 pdf, zero_case)
     }
 }
 
@@ -175,13 +188,22 @@
 ///
 /// This distribution has density function: `f(x) = lambda * exp(-lambda * x)`
 /// for `x > 0`.
+/// 
+/// Note that [`Exp1`][crate::distributions::Exp1] is an optimised implementation for `lambda = 1`.
 ///
-/// Note that [`Exp1`](crate::distributions::Exp1) is an optimised implementation for `lambda = 1`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Exp, Distribution};
+///
+/// let exp = Exp::new(2.0);
+/// let v = exp.sample(&mut rand::thread_rng());
+/// println!("{} is from a Exp(2) distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Exp {
     /// `lambda` stored as `1/lambda`, since this is what we scale by.
-    lambda_inverse: f64,
+    lambda_inverse: f64
 }
 
 impl Exp {
@@ -190,9 +212,7 @@
     #[inline]
     pub fn new(lambda: f64) -> Exp {
         assert!(lambda > 0.0, "Exp::new called with `lambda` <= 0");
-        Exp {
-            lambda_inverse: 1.0 / lambda,
-        }
+        Exp { lambda_inverse: 1.0 / lambda }
     }
 }
 
@@ -205,13 +225,13 @@
 
 #[cfg(test)]
 mod test {
+    use distributions::Distribution;
     use super::Exp;
-    use crate::distributions::Distribution;
 
     #[test]
     fn test_exp() {
         let exp = Exp::new(10.0);
-        let mut rng = crate::test::rng(221);
+        let mut rng = ::test::rng(221);
         for _ in 0..1000 {
             assert!(exp.sample(&mut rng) >= 0.0);
         }
diff --git a/src/rand/distributions/float.rs.html b/src/rand/distributions/float.rs.html
index 036f11e..59aa1f8 100644
--- a/src/rand/distributions/float.rs.html
+++ b/src/rand/distributions/float.rs.html
@@ -1,4 +1,4 @@
-float.rs.html -- source
  1
+float.rs.html -- source
  1
   2
   3
   4
@@ -257,54 +257,6 @@
 257
 258
 259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
-292
-293
-294
-295
-296
-297
-298
-299
-300
-301
-302
-303
-304
-305
-306
-307
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -316,17 +268,18 @@
 
 //! Basic floating-point number distributions
 
-use crate::distributions::utils::FloatSIMDUtils;
-use crate::distributions::{Distribution, Standard};
-use crate::Rng;
 use core::mem;
-#[cfg(feature = "simd_support")] use packed_simd::*;
+use Rng;
+use distributions::{Distribution, Standard};
+use distributions::utils::FloatSIMDUtils;
+#[cfg(feature="simd_support")]
+use packed_simd::*;
 
 /// A distribution to sample floating point numbers uniformly in the half-open
 /// interval `(0, 1]`, i.e. including 1 but not 0.
 ///
 /// All values that can be generated are of the form `n * ε/2`. For `f32`
-/// the 24 most significant random bits of a `u32` are used and for `f64` the
+/// the 23 most significant random bits of a `u32` are used and for `f64` the
 /// 53 most significant bits of a `u64` are used. The conversion uses the
 /// multiplicative method.
 ///
@@ -353,7 +306,7 @@
 /// interval `(0, 1)`, i.e. not including either endpoint.
 ///
 /// All values that can be generated are of the form `n * ε + ε/2`. For `f32`
-/// the 23 most significant random bits of an `u32` are used, for `f64` 52 from
+/// the 22 most significant random bits of an `u32` are used, for `f64` 52 from
 /// an `u64`. The conversion uses a transmute-based method.
 ///
 /// See also: [`Standard`] which samples from `[0, 1)`, [`OpenClosed01`]
@@ -376,9 +329,7 @@
 pub struct Open01;
 
 
-// This trait is needed by both this lib and rand_distr hence is a hidden export
-#[doc(hidden)]
-pub trait IntoFloat {
+pub(crate) trait IntoFloat {
     type F;
 
     /// Helper method to combine the fraction and a contant exponent into a
@@ -402,7 +353,9 @@
                 // The exponent is encoded using an offset-binary representation
                 let exponent_bits: $u_scalar =
                     (($exponent_bias + exponent) as $u_scalar) << $fraction_bits;
-                $ty::from_bits(self | exponent_bits)
+                // TODO: use from_bits when min compiler > 1.25 (see #545)
+                // $ty::from_bits(self | exponent_bits)
+                unsafe{ mem::transmute(self | exponent_bits) }
             }
         }
 
@@ -456,27 +409,30 @@
 float_impls! { f32, u32, f32, u32, 23, 127 }
 float_impls! { f64, u64, f64, u64, 52, 1023 }
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f32x2, u32x2, f32, u32, 23, 127 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f32x4, u32x4, f32, u32, 23, 127 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f32x8, u32x8, f32, u32, 23, 127 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f32x16, u32x16, f32, u32, 23, 127 }
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f64x2, u64x2, f64, u64, 52, 1023 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f64x4, u64x4, f64, u64, 52, 1023 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 float_impls! { f64x8, u64x8, f64, u64, 52, 1023 }
 
 
 #[cfg(test)]
 mod tests {
-    use super::*;
-    use crate::rngs::mock::StepRng;
+    use Rng;
+    use distributions::{Open01, OpenClosed01};
+    use rngs::mock::StepRng;
+    #[cfg(feature="simd_support")]
+    use packed_simd::*;
 
     const EPSILON32: f32 = ::core::f32::EPSILON;
     const EPSILON64: f64 = ::core::f64::EPSILON;
@@ -495,7 +451,8 @@
 
                 // OpenClosed01
                 let mut zeros = StepRng::new(0, 0);
-                assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), 0.0 + $EPSILON / 2.0);
+                assert_eq!(zeros.sample::<$ty, _>(OpenClosed01),
+                           0.0 + $EPSILON / 2.0);
                 let mut one = StepRng::new(1 << 8 | 1 << (8 + 32), 0);
                 assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON);
                 let mut max = StepRng::new(!0, 0);
@@ -509,16 +466,16 @@
                 let mut max = StepRng::new(!0, 0);
                 assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0);
             }
-        };
+        }
     }
     test_f32! { f32_edge_cases, f32, 0.0, EPSILON32 }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f32! { f32x2_edge_cases, f32x2, f32x2::splat(0.0), f32x2::splat(EPSILON32) }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f32! { f32x4_edge_cases, f32x4, f32x4::splat(0.0), f32x4::splat(EPSILON32) }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f32! { f32x8_edge_cases, f32x8, f32x8::splat(0.0), f32x8::splat(EPSILON32) }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f32! { f32x16_edge_cases, f32x16, f32x16::splat(0.0), f32x16::splat(EPSILON32) }
 
     macro_rules! test_f64 {
@@ -535,7 +492,8 @@
 
                 // OpenClosed01
                 let mut zeros = StepRng::new(0, 0);
-                assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), 0.0 + $EPSILON / 2.0);
+                assert_eq!(zeros.sample::<$ty, _>(OpenClosed01),
+                           0.0 + $EPSILON / 2.0);
                 let mut one = StepRng::new(1 << 11, 0);
                 assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON);
                 let mut max = StepRng::new(!0, 0);
@@ -549,69 +507,15 @@
                 let mut max = StepRng::new(!0, 0);
                 assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0);
             }
-        };
+        }
     }
     test_f64! { f64_edge_cases, f64, 0.0, EPSILON64 }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f64! { f64x2_edge_cases, f64x2, f64x2::splat(0.0), f64x2::splat(EPSILON64) }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f64! { f64x4_edge_cases, f64x4, f64x4::splat(0.0), f64x4::splat(EPSILON64) }
-    #[cfg(feature = "simd_support")]
+    #[cfg(feature="simd_support")]
     test_f64! { f64x8_edge_cases, f64x8, f64x8::splat(0.0), f64x8::splat(EPSILON64) }
-
-    #[test]
-    fn value_stability() {
-        fn test_samples<T: Copy + core::fmt::Debug + PartialEq, D: Distribution<T>>(
-            distr: &D, zero: T, expected: &[T],
-        ) {
-            let mut rng = crate::test::rng(0x6f44f5646c2a7334);
-            let mut buf = [zero; 3];
-            for x in &mut buf {
-                *x = rng.sample(&distr);
-            }
-            assert_eq!(&buf, expected);
-        }
-
-        test_samples(&Standard, 0f32, &[0.0035963655, 0.7346052, 0.09778172]);
-        test_samples(&Standard, 0f64, &[
-            0.7346051961657583,
-            0.20298547462974248,
-            0.8166436635290655,
-        ]);
-
-        test_samples(&OpenClosed01, 0f32, &[0.003596425, 0.73460525, 0.09778178]);
-        test_samples(&OpenClosed01, 0f64, &[
-            0.7346051961657584,
-            0.2029854746297426,
-            0.8166436635290656,
-        ]);
-
-        test_samples(&Open01, 0f32, &[0.0035963655, 0.73460525, 0.09778172]);
-        test_samples(&Open01, 0f64, &[
-            0.7346051961657584,
-            0.20298547462974248,
-            0.8166436635290656,
-        ]);
-
-        #[cfg(feature = "simd_support")]
-        {
-            // We only test a sub-set of types here. Values are identical to
-            // non-SIMD types; we assume this pattern continues across all
-            // SIMD types.
-
-            test_samples(&Standard, f32x2::new(0.0, 0.0), &[
-                f32x2::new(0.0035963655, 0.7346052),
-                f32x2::new(0.09778172, 0.20298547),
-                f32x2::new(0.34296435, 0.81664366),
-            ]);
-
-            test_samples(&Standard, f64x2::new(0.0, 0.0), &[
-                f64x2::new(0.7346051961657583, 0.20298547462974248),
-                f64x2::new(0.8166436635290655, 0.7423708925400552),
-                f64x2::new(0.16387782224016323, 0.9087068770169618),
-            ]);
-        }
-    }
 }
 
\ No newline at end of file diff --git a/src/rand/distributions/gamma.rs.html b/src/rand/distributions/gamma.rs.html index f9d462a..7eee873 100644 --- a/src/rand/distributions/gamma.rs.html +++ b/src/rand/distributions/gamma.rs.html @@ -1,4 +1,4 @@ -gamma.rs.html -- source
  1
+gamma.rs.html -- source
  1
   2
   3
   4
@@ -371,6 +371,46 @@
 371
 372
 373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -382,14 +422,13 @@
 // except according to those terms.
 
 //! The Gamma and derived distributions.
-#![allow(deprecated)]
 
-use self::ChiSquaredRepr::*;
 use self::GammaRepr::*;
+use self::ChiSquaredRepr::*;
 
-use crate::distributions::normal::StandardNormal;
-use crate::distributions::{Distribution, Exp, Open01};
-use crate::Rng;
+use Rng;
+use distributions::normal::StandardNormal;
+use distributions::{Distribution, Exp, Open01};
 
 /// The Gamma distribution `Gamma(shape, scale)` distribution.
 ///
@@ -407,11 +446,20 @@
 /// == 1`, and using the boosting technique described in that paper for
 /// `shape < 1`.
 ///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Distribution, Gamma};
+///
+/// let gamma = Gamma::new(2.0, 5.0);
+/// let v = gamma.sample(&mut rand::thread_rng());
+/// println!("{} is from a Gamma(2, 5) distribution", v);
+/// ```
+///
 /// [^1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for
 ///       Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3
 ///       (September 2000), 363-372.
 ///       DOI:[10.1145/358407.358414](https://doi.acm.org/10.1145/358407.358414)
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
 #[derive(Clone, Copy, Debug)]
 pub struct Gamma {
     repr: GammaRepr,
@@ -421,7 +469,7 @@
 enum GammaRepr {
     Large(GammaLargeShape),
     One(Exp),
-    Small(GammaSmallShape),
+    Small(GammaSmallShape)
 }
 
 // These two helpers could be made public, but saving the
@@ -441,7 +489,7 @@
 #[derive(Clone, Copy, Debug)]
 struct GammaSmallShape {
     inv_shape: f64,
-    large_shape: GammaLargeShape,
+    large_shape: GammaLargeShape
 }
 
 /// Gamma distribution where the shape parameter is larger than 1.
@@ -452,7 +500,7 @@
 struct GammaLargeShape {
     scale: f64,
     c: f64,
-    d: f64,
+    d: f64
 }
 
 impl Gamma {
@@ -480,7 +528,7 @@
     fn new_raw(shape: f64, scale: f64) -> GammaSmallShape {
         GammaSmallShape {
             inv_shape: 1. / shape,
-            large_shape: GammaLargeShape::new_raw(shape + 1.0, scale),
+            large_shape: GammaLargeShape::new_raw(shape + 1.0, scale)
         }
     }
 }
@@ -491,7 +539,7 @@
         GammaLargeShape {
             scale,
             c: 1. / (9. * d).sqrt(),
-            d,
+            d
         }
     }
 }
@@ -517,19 +565,17 @@
         loop {
             let x = rng.sample(StandardNormal);
             let v_cbrt = 1.0 + self.c * x;
-            if v_cbrt <= 0.0 {
-                // a^3 <= 0 iff a <= 0
-                continue;
+            if v_cbrt <= 0.0 { // a^3 <= 0 iff a <= 0
+                continue
             }
 
             let v = v_cbrt * v_cbrt * v_cbrt;
             let u: f64 = rng.sample(Open01);
 
             let x_sqr = x * x;
-            if u < 1.0 - 0.0331 * x_sqr * x_sqr
-                || u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln())
-            {
-                return self.d * v * self.scale;
+            if u < 1.0 - 0.0331 * x_sqr * x_sqr ||
+                u.ln() < 0.5 * x_sqr + self.d * (1.0 - v + v.ln()) {
+                return self.d * v * self.scale
             }
         }
     }
@@ -542,7 +588,16 @@
 /// of `k` independent standard normal random variables. For other
 /// `k`, this uses the equivalent characterisation
 /// `χ²(k) = Gamma(k/2, 2)`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{ChiSquared, Distribution};
+///
+/// let chi = ChiSquared::new(11.0);
+/// let v = chi.sample(&mut rand::thread_rng());
+/// println!("{} is from a χ²(11) distribution", v)
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct ChiSquared {
     repr: ChiSquaredRepr,
@@ -578,7 +633,7 @@
                 let norm = rng.sample(StandardNormal);
                 norm * norm
             }
-            DoFAnythingElse(ref g) => g.sample(rng),
+            DoFAnythingElse(ref g) => g.sample(rng)
         }
     }
 }
@@ -588,7 +643,16 @@
 /// This distribution is equivalent to the ratio of two normalised
 /// chi-squared distributions, that is, `F(m,n) = (χ²(m)/m) /
 /// (χ²(n)/n)`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{FisherF, Distribution};
+///
+/// let f = FisherF::new(2.0, 32.0);
+/// let v = f.sample(&mut rand::thread_rng());
+/// println!("{} is from an F(2, 32) distribution", v)
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct FisherF {
     numer: ChiSquared,
@@ -608,7 +672,7 @@
         FisherF {
             numer: ChiSquared::new(m),
             denom: ChiSquared::new(n),
-            dof_ratio: n / m,
+            dof_ratio: n / m
         }
     }
 }
@@ -620,11 +684,20 @@
 
 /// The Student t distribution, `t(nu)`, where `nu` is the degrees of
 /// freedom.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{StudentT, Distribution};
+///
+/// let t = StudentT::new(11.0);
+/// let v = t.sample(&mut rand::thread_rng());
+/// println!("{} is from a t(11) distribution", v)
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct StudentT {
     chi: ChiSquared,
-    dof: f64,
+    dof: f64
 }
 
 impl StudentT {
@@ -634,7 +707,7 @@
         assert!(n > 0.0, "StudentT::new called with `n <= 0`");
         StudentT {
             chi: ChiSquared::new(n),
-            dof: n,
+            dof: n
         }
     }
 }
@@ -646,7 +719,16 @@
 }
 
 /// The Beta distribution with shape parameters `alpha` and `beta`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Distribution, Beta};
+///
+/// let beta = Beta::new(2.0, 5.0);
+/// let v = beta.sample(&mut rand::thread_rng());
+/// println!("{} is from a Beta(2, 5) distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Beta {
     gamma_a: Gamma,
@@ -677,32 +759,30 @@
 
 #[cfg(test)]
 mod test {
-    use super::{Beta, ChiSquared, FisherF, StudentT};
-    use crate::distributions::Distribution;
-
-    const N: u32 = 100;
+    use distributions::Distribution;
+    use super::{Beta, ChiSquared, StudentT, FisherF};
 
     #[test]
     fn test_chi_squared_one() {
         let chi = ChiSquared::new(1.0);
-        let mut rng = crate::test::rng(201);
-        for _ in 0..N {
+        let mut rng = ::test::rng(201);
+        for _ in 0..1000 {
             chi.sample(&mut rng);
         }
     }
     #[test]
     fn test_chi_squared_small() {
         let chi = ChiSquared::new(0.5);
-        let mut rng = crate::test::rng(202);
-        for _ in 0..N {
+        let mut rng = ::test::rng(202);
+        for _ in 0..1000 {
             chi.sample(&mut rng);
         }
     }
     #[test]
     fn test_chi_squared_large() {
         let chi = ChiSquared::new(30.0);
-        let mut rng = crate::test::rng(203);
-        for _ in 0..N {
+        let mut rng = ::test::rng(203);
+        for _ in 0..1000 {
             chi.sample(&mut rng);
         }
     }
@@ -715,8 +795,8 @@
     #[test]
     fn test_f() {
         let f = FisherF::new(2.0, 32.0);
-        let mut rng = crate::test::rng(204);
-        for _ in 0..N {
+        let mut rng = ::test::rng(204);
+        for _ in 0..1000 {
             f.sample(&mut rng);
         }
     }
@@ -724,8 +804,8 @@
     #[test]
     fn test_t() {
         let t = StudentT::new(11.0);
-        let mut rng = crate::test::rng(205);
-        for _ in 0..N {
+        let mut rng = ::test::rng(205);
+        for _ in 0..1000 {
             t.sample(&mut rng);
         }
     }
@@ -733,8 +813,8 @@
     #[test]
     fn test_beta() {
         let beta = Beta::new(1.0, 2.0);
-        let mut rng = crate::test::rng(201);
-        for _ in 0..N {
+        let mut rng = ::test::rng(201);
+        for _ in 0..1000 {
             beta.sample(&mut rng);
         }
     }
diff --git a/src/rand/distributions/integer.rs.html b/src/rand/distributions/integer.rs.html
index 6eea4bf..23a3e7a 100644
--- a/src/rand/distributions/integer.rs.html
+++ b/src/rand/distributions/integer.rs.html
@@ -1,4 +1,4 @@
-integer.rs.html -- source
  1
+integer.rs.html -- source
  1
   2
   3
   4
@@ -159,124 +159,6 @@
 159
 160
 161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -288,14 +170,14 @@
 
 //! The implementations of the `Standard` distribution for integer types.
 
-use crate::distributions::{Distribution, Standard};
-use crate::Rng;
-#[cfg(all(target_arch = "x86", feature = "nightly"))] use core::arch::x86::*;
-#[cfg(all(target_arch = "x86_64", feature = "nightly"))]
+use {Rng};
+use distributions::{Distribution, Standard};
+#[cfg(feature="simd_support")]
+use packed_simd::*;
+#[cfg(all(target_arch = "x86", feature="nightly"))]
+use core::arch::x86::*;
+#[cfg(all(target_arch = "x86_64", feature="nightly"))]
 use core::arch::x86_64::*;
-#[cfg(not(target_os = "emscripten"))] use core::num::NonZeroU128;
-use core::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
-#[cfg(feature = "simd_support")] use packed_simd::*;
 
 impl Distribution<u8> for Standard {
     #[inline]
@@ -325,13 +207,13 @@
     }
 }
 
-#[cfg(not(target_os = "emscripten"))]
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
 impl Distribution<u128> for Standard {
     #[inline]
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> u128 {
         // Use LE; we explicitly generate one value before the next.
-        let x = u128::from(rng.next_u64());
-        let y = u128::from(rng.next_u64());
+        let x = rng.next_u64() as u128;
+        let y = rng.next_u64() as u128;
         (y << 64) | x
     }
 }
@@ -358,40 +240,17 @@
                 rng.gen::<$uty>() as $ty
             }
         }
-    };
+    }
 }
 
 impl_int_from_uint! { i8, u8 }
 impl_int_from_uint! { i16, u16 }
 impl_int_from_uint! { i32, u32 }
 impl_int_from_uint! { i64, u64 }
-#[cfg(not(target_os = "emscripten"))]
-impl_int_from_uint! { i128, u128 }
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_int_from_uint! { i128, u128 }
 impl_int_from_uint! { isize, usize }
 
-macro_rules! impl_nzint {
-    ($ty:ty, $new:path) => {
-        impl Distribution<$ty> for Standard {
-            fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> $ty {
-                loop {
-                    if let Some(nz) = $new(rng.gen()) {
-                        break nz;
-                    }
-                }
-            }
-        }
-    };
-}
-
-impl_nzint!(NonZeroU8, NonZeroU8::new);
-impl_nzint!(NonZeroU16, NonZeroU16::new);
-impl_nzint!(NonZeroU32, NonZeroU32::new);
-impl_nzint!(NonZeroU64, NonZeroU64::new);
-#[cfg(not(target_os = "emscripten"))]
-impl_nzint!(NonZeroU128, NonZeroU128::new);
-impl_nzint!(NonZeroUsize, NonZeroUsize::new);
-
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 macro_rules! simd_impl {
     ($(($intrinsic:ident, $vec:ty),)+) => {$(
         impl Distribution<$intrinsic> for Standard {
@@ -421,141 +280,46 @@
     };
 }
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(16, u8x2, i8x2,);
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(32, u8x4, i8x4, u16x2, i16x2,);
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(64, u8x8, i8x8, u16x4, i16x4, u32x2, i32x2,);
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(128, u8x16, i8x16, u16x8, i16x8, u32x4, i32x4, u64x2, i64x2,);
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(256, u8x32, i8x32, u16x16, i16x16, u32x8, i32x8, u64x4, i64x4,);
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 simd_impl!(512, u8x64, i8x64, u16x32, i16x32, u32x16, i32x16, u64x8, i64x8,);
-#[cfg(all(
-    feature = "simd_support",
-    feature = "nightly",
-    any(target_arch = "x86", target_arch = "x86_64")
-))]
+#[cfg(all(feature="simd_support", feature="nightly", any(target_arch="x86", target_arch="x86_64")))]
 simd_impl!((__m64, u8x8), (__m128i, u8x16), (__m256i, u8x32),);
 
 #[cfg(test)]
 mod tests {
-    use super::*;
-
+    use Rng;
+    use distributions::{Standard};
+    
     #[test]
     fn test_integers() {
-        let mut rng = crate::test::rng(806);
-
+        let mut rng = ::test::rng(806);
+        
         rng.sample::<isize, _>(Standard);
         rng.sample::<i8, _>(Standard);
         rng.sample::<i16, _>(Standard);
         rng.sample::<i32, _>(Standard);
         rng.sample::<i64, _>(Standard);
-        #[cfg(not(target_os = "emscripten"))]
+        #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
         rng.sample::<i128, _>(Standard);
-
+        
         rng.sample::<usize, _>(Standard);
         rng.sample::<u8, _>(Standard);
         rng.sample::<u16, _>(Standard);
         rng.sample::<u32, _>(Standard);
         rng.sample::<u64, _>(Standard);
-        #[cfg(not(target_os = "emscripten"))]
+        #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
         rng.sample::<u128, _>(Standard);
     }
-
-    #[test]
-    fn value_stability() {
-        fn test_samples<T: Copy + core::fmt::Debug + PartialEq>(zero: T, expected: &[T])
-        where Standard: Distribution<T> {
-            let mut rng = crate::test::rng(807);
-            let mut buf = [zero; 3];
-            for x in &mut buf {
-                *x = rng.sample(Standard);
-            }
-            assert_eq!(&buf, expected);
-        }
-
-        test_samples(0u8, &[9, 247, 111]);
-        test_samples(0u16, &[32265, 42999, 38255]);
-        test_samples(0u32, &[2220326409, 2575017975, 2018088303]);
-        test_samples(0u64, &[
-            11059617991457472009,
-            16096616328739788143,
-            1487364411147516184,
-        ]);
-        test_samples(0u128, &[
-            296930161868957086625409848350820761097,
-            145644820879247630242265036535529306392,
-            111087889832015897993126088499035356354,
-        ]);
-        #[cfg(any(target_pointer_width = "32", target_pointer_width = "16"))]
-        test_samples(0usize, &[2220326409, 2575017975, 2018088303]);
-        #[cfg(target_pointer_width = "64")]
-        test_samples(0usize, &[
-            11059617991457472009,
-            16096616328739788143,
-            1487364411147516184,
-        ]);
-
-        test_samples(0i8, &[9, -9, 111]);
-        // Skip further i* types: they are simple reinterpretation of u* samples
-
-        #[cfg(feature = "simd_support")]
-        {
-            // We only test a sub-set of types here and make assumptions about the rest.
-
-            test_samples(u8x2::default(), &[
-                u8x2::new(9, 126),
-                u8x2::new(247, 167),
-                u8x2::new(111, 149),
-            ]);
-            test_samples(u8x4::default(), &[
-                u8x4::new(9, 126, 87, 132),
-                u8x4::new(247, 167, 123, 153),
-                u8x4::new(111, 149, 73, 120),
-            ]);
-            test_samples(u8x8::default(), &[
-                u8x8::new(9, 126, 87, 132, 247, 167, 123, 153),
-                u8x8::new(111, 149, 73, 120, 68, 171, 98, 223),
-                u8x8::new(24, 121, 1, 50, 13, 46, 164, 20),
-            ]);
-
-            test_samples(i64x8::default(), &[
-                i64x8::new(
-                    -7387126082252079607,
-                    -2350127744969763473,
-                    1487364411147516184,
-                    7895421560427121838,
-                    602190064936008898,
-                    6022086574635100741,
-                    -5080089175222015595,
-                    -4066367846667249123,
-                ),
-                i64x8::new(
-                    9180885022207963908,
-                    3095981199532211089,
-                    6586075293021332726,
-                    419343203796414657,
-                    3186951873057035255,
-                    5287129228749947252,
-                    444726432079249540,
-                    -1587028029513790706,
-                ),
-                i64x8::new(
-                    6075236523189346388,
-                    1351763722368165432,
-                    -6192309979959753740,
-                    -7697775502176768592,
-                    -4482022114172078123,
-                    7522501477800909500,
-                    -1837258847956201231,
-                    -586926753024886735,
-                ),
-            ]);
-        }
-    }
 }
 
\ No newline at end of file diff --git a/src/rand/distributions/mod.rs.html b/src/rand/distributions/mod.rs.html index 765fe46..cbcd327 100644 --- a/src/rand/distributions/mod.rs.html +++ b/src/rand/distributions/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs.html -- source
  1
+mod.rs.html -- source
  1
   2
   3
   4
@@ -404,6 +404,208 @@
 404
 405
 406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013-2017 The Rust Project Developers.
@@ -414,12 +616,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Generating random samples from probability distributions
+//! Generating random samples from probability distributions.
 //!
 //! This module is the home of the [`Distribution`] trait and several of its
 //! implementations. It is the workhorse behind some of the convenient
-//! functionality of the [`Rng`] trait, e.g. [`Rng::gen`], [`Rng::gen_range`] and
-//! of course [`Rng::sample`].
+//! functionality of the [`Rng`] trait, including [`gen`], [`gen_range`] and
+//! of course [`sample`].
 //!
 //! Abstractly, a [probability distribution] describes the probability of
 //! occurance of each value in its sample space.
@@ -438,23 +640,17 @@
 //! # The `Standard` distribution
 //!
 //! The [`Standard`] distribution is important to mention. This is the
-//! distribution used by [`Rng::gen`] and represents the "default" way to
+//! distribution used by [`Rng::gen()`] and represents the "default" way to
 //! produce a random value for many different types, including most primitive
 //! types, tuples, arrays, and a few derived types. See the documentation of
 //! [`Standard`] for more details.
 //!
 //! Implementing `Distribution<T>` for [`Standard`] for user types `T` makes it
-//! possible to generate type `T` with [`Rng::gen`], and by extension also
-//! with the [`random`] function.
-//!
-//! ## Random characters
-//!
-//! [`Alphanumeric`] is a simple distribution to sample random letters and
-//! numbers of the `char` type; in contrast [`Standard`] may sample any valid
-//! `char`.
+//! possible to generate type `T` with [`Rng::gen()`], and by extension also
+//! with the [`random()`] function.
 //!
 //!
-//! # Uniform numeric ranges
+//! # Distribution to sample from a `Uniform` range
 //!
 //! The [`Uniform`] distribution is more flexible than [`Standard`], but also
 //! more specialised: it supports fewer target types, but allows the sample
@@ -472,7 +668,8 @@
 //! documentation in the [`uniform`] module. Doing so enables generation of
 //! values of type `T` with  [`Rng::gen_range`].
 //!
-//! ## Open and half-open ranges
+//!
+//! # Other distributions
 //!
 //! There are surprisingly many ways to uniformly generate random floats. A
 //! range between 0 and 1 is standard, but the exact bounds (open vs closed)
@@ -480,99 +677,155 @@
 //! [`Open01`] and [`OpenClosed01`]. See "Floating point implementation" section of
 //! [`Standard`] documentation for more details.
 //!
-//! # Non-uniform sampling
+//! [`Alphanumeric`] is a simple distribution to sample random letters and
+//! numbers of the `char` type; in contrast [`Standard`] may sample any valid
+//! `char`.
 //!
-//! Sampling a simple true/false outcome with a given probability has a name:
-//! the [`Bernoulli`] distribution (this is used by [`Rng::gen_bool`]).
+//! [`WeightedIndex`] can be used to do weighted sampling from a set of items,
+//! such as from an array.
 //!
-//! For weighted sampling from a sequence of discrete values, use the
-//! [`weighted`] module.
+//! # Non-uniform probability distributions
 //!
-//! This crate no longer includes other non-uniform distributions; instead
-//! it is recommended that you use either [`rand_distr`] or [`statrs`].
+//! Rand currently provides the following probability distributions:
+//!
+//! - Related to real-valued quantities that grow linearly
+//!   (e.g. errors, offsets):
+//!   - [`Normal`] distribution, and [`StandardNormal`] as a primitive
+//!   - [`Cauchy`] distribution
+//! - Related to Bernoulli trials (yes/no events, with a given probability):
+//!   - [`Binomial`] distribution
+//!   - [`Bernoulli`] distribution, similar to [`Rng::gen_bool`].
+//! - Related to positive real-valued quantities that grow exponentially
+//!   (e.g. prices, incomes, populations):
+//!   - [`LogNormal`] distribution
+//! - Related to the occurrence of independent events at a given rate:
+//!   - [`Pareto`] distribution
+//!   - [`Poisson`] distribution
+//!   - [`Exp`]onential distribution, and [`Exp1`] as a primitive
+//!   - [`Weibull`] distribution
+//! - Gamma and derived distributions:
+//!   - [`Gamma`] distribution
+//!   - [`ChiSquared`] distribution
+//!   - [`StudentT`] distribution
+//!   - [`FisherF`] distribution
+//! - Triangular distribution:
+//!   - [`Beta`] distribution
+//!   - [`Triangular`] distribution
+//! - Multivariate probability distributions
+//!   - [`Dirichlet`] distribution
+//!   - [`UnitSphereSurface`] distribution
+//!   - [`UnitCircle`] distribution
+//!
+//! # Examples
+//!
+//! Sampling from a distribution:
+//!
+//! ```
+//! use rand::{thread_rng, Rng};
+//! use rand::distributions::Exp;
+//!
+//! let exp = Exp::new(2.0);
+//! let v = thread_rng().sample(exp);
+//! println!("{} is from an Exp(2) distribution", v);
+//! ```
+//!
+//! Implementing the [`Standard`] distribution for a user type:
+//!
+//! ```
+//! # #![allow(dead_code)]
+//! use rand::Rng;
+//! use rand::distributions::{Distribution, Standard};
+//!
+//! struct MyF32 {
+//!     x: f32,
+//! }
+//!
+//! impl Distribution<MyF32> for Standard {
+//!     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
+//!         MyF32 { x: rng.gen() }
+//!     }
+//! }
+//! ```
 //!
 //!
 //! [probability distribution]: https://en.wikipedia.org/wiki/Probability_distribution
-//! [`rand_distr`]: https://crates.io/crates/rand_distr
-//! [`statrs`]: https://crates.io/crates/statrs
+//! [`gen_range`]: Rng::gen_range
+//! [`gen`]: Rng::gen
+//! [`sample`]: Rng::sample
+//! [`new_inclusive`]: Uniform::new_inclusive
+//! [`Alphanumeric`]: distributions::Alphanumeric
+//! [`Bernoulli`]: distributions::Bernoulli
+//! [`Beta`]: distributions::Beta
+//! [`Binomial`]: distributions::Binomial
+//! [`Cauchy`]: distributions::Cauchy
+//! [`ChiSquared`]: distributions::ChiSquared
+//! [`Dirichlet`]: distributions::Dirichlet
+//! [`Exp`]: distributions::Exp
+//! [`Exp1`]: distributions::Exp1
+//! [`FisherF`]: distributions::FisherF
+//! [`Gamma`]: distributions::Gamma
+//! [`LogNormal`]: distributions::LogNormal
+//! [`Normal`]: distributions::Normal
+//! [`Open01`]: distributions::Open01
+//! [`OpenClosed01`]: distributions::OpenClosed01
+//! [`Pareto`]: distributions::Pareto
+//! [`Poisson`]: distributions::Poisson
+//! [`Standard`]: distributions::Standard
+//! [`StandardNormal`]: distributions::StandardNormal
+//! [`StudentT`]: distributions::StudentT
+//! [`Triangular`]: distributions::Triangular
+//! [`Uniform`]: distributions::Uniform
+//! [`Uniform::new`]: distributions::Uniform::new
+//! [`Uniform::new_inclusive`]: distributions::Uniform::new_inclusive
+//! [`UnitSphereSurface`]: distributions::UnitSphereSurface
+//! [`UnitCircle`]: distributions::UnitCircle
+//! [`Weibull`]: distributions::Weibull
+//! [`WeightedIndex`]: distributions::WeightedIndex
 
-//! [`random`]: crate::random
-//! [`rand_distr`]: https://crates.io/crates/rand_distr
-//! [`statrs`]: https://crates.io/crates/statrs
-
-use crate::Rng;
+#[cfg(any(rustc_1_26, features="nightly"))]
 use core::iter;
+use Rng;
 
-pub use self::bernoulli::{Bernoulli, BernoulliError};
-pub use self::float::{Open01, OpenClosed01};
 pub use self::other::Alphanumeric;
 #[doc(inline)] pub use self::uniform::Uniform;
-#[cfg(feature = "alloc")]
-pub use self::weighted::{WeightedError, WeightedIndex};
+pub use self::float::{OpenClosed01, Open01};
+pub use self::bernoulli::Bernoulli;
+#[cfg(feature="alloc")] pub use self::weighted::{WeightedIndex, WeightedError};
+#[cfg(feature="std")] pub use self::unit_sphere::UnitSphereSurface;
+#[cfg(feature="std")] pub use self::unit_circle::UnitCircle;
+#[cfg(feature="std")] pub use self::gamma::{Gamma, ChiSquared, FisherF,
+    StudentT, Beta};
+#[cfg(feature="std")] pub use self::normal::{Normal, LogNormal, StandardNormal};
+#[cfg(feature="std")] pub use self::exponential::{Exp, Exp1};
+#[cfg(feature="std")] pub use self::pareto::Pareto;
+#[cfg(feature="std")] pub use self::poisson::Poisson;
+#[cfg(feature="std")] pub use self::binomial::Binomial;
+#[cfg(feature="std")] pub use self::cauchy::Cauchy;
+#[cfg(feature="std")] pub use self::dirichlet::Dirichlet;
+#[cfg(feature="std")] pub use self::triangular::Triangular;
+#[cfg(feature="std")] pub use self::weibull::Weibull;
 
-// The following are all deprecated after being moved to rand_distr
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::binomial::Binomial;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::cauchy::Cauchy;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::dirichlet::Dirichlet;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::exponential::{Exp, Exp1};
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::gamma::{Beta, ChiSquared, FisherF, Gamma, StudentT};
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::normal::{LogNormal, Normal, StandardNormal};
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::pareto::Pareto;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::poisson::Poisson;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::triangular::Triangular;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::unit_circle::UnitCircle;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::unit_sphere::UnitSphereSurface;
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::weibull::Weibull;
-
-mod bernoulli;
-#[cfg(feature = "std")] mod binomial;
-#[cfg(feature = "std")] mod cauchy;
-#[cfg(feature = "std")] mod dirichlet;
-#[cfg(feature = "std")] mod exponential;
-#[cfg(feature = "std")] mod gamma;
-#[cfg(feature = "std")] mod normal;
-#[cfg(feature = "std")] mod pareto;
-#[cfg(feature = "std")] mod poisson;
-#[cfg(feature = "std")] mod triangular;
 pub mod uniform;
-#[cfg(feature = "std")] mod unit_circle;
-#[cfg(feature = "std")] mod unit_sphere;
-#[cfg(feature = "std")] mod weibull;
-#[cfg(feature = "alloc")] pub mod weighted;
+mod bernoulli;
+#[cfg(feature="alloc")] mod weighted;
+#[cfg(feature="std")] mod unit_sphere;
+#[cfg(feature="std")] mod unit_circle;
+#[cfg(feature="std")] mod gamma;
+#[cfg(feature="std")] mod normal;
+#[cfg(feature="std")] mod exponential;
+#[cfg(feature="std")] mod pareto;
+#[cfg(feature="std")] mod poisson;
+#[cfg(feature="std")] mod binomial;
+#[cfg(feature="std")] mod cauchy;
+#[cfg(feature="std")] mod dirichlet;
+#[cfg(feature="std")] mod triangular;
+#[cfg(feature="std")] mod weibull;
 
 mod float;
-#[doc(hidden)]
-pub mod hidden_export {
-    pub use super::float::IntoFloat; // used by rand_distr
-}
 mod integer;
 mod other;
 mod utils;
-#[cfg(feature = "std")] mod ziggurat_tables;
+#[cfg(feature="std")] mod ziggurat_tables;
 
 /// Types (distributions) that can be used to create a random instance of `T`.
 ///
@@ -585,12 +838,6 @@
 /// advantage of not needing to consider thread safety, and for most
 /// distributions efficient state-less sampling algorithms are available.
 ///
-/// Implementations are typically expected to be portable with reproducible
-/// results when used with a PRNG with fixed seed; see the
-/// [portability chapter](https://rust-random.github.io/book/portability.html)
-/// of The Rust Rand Book. In some cases this does not apply, e.g. the `usize`
-/// type requires different sampling on 32-bit and 64-bit machines.
-///
 /// [`sample_iter`]: Distribution::method.sample_iter
 pub trait Distribution<T> {
     /// Generate a random value of `T`, using `rng` as the source of randomness.
@@ -599,41 +846,33 @@
     /// Create an iterator that generates random values of `T`, using `rng` as
     /// the source of randomness.
     ///
-    /// Note that this function takes `self` by value. This works since
-    /// `Distribution<T>` is impl'd for `&D` where `D: Distribution<T>`,
-    /// however borrowing is not automatic hence `distr.sample_iter(...)` may
-    /// need to be replaced with `(&distr).sample_iter(...)` to borrow or
-    /// `(&*distr).sample_iter(...)` to reborrow an existing reference.
-    ///
     /// # Example
     ///
     /// ```
     /// use rand::thread_rng;
     /// use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard};
     ///
-    /// let rng = thread_rng();
+    /// let mut rng = thread_rng();
     ///
     /// // Vec of 16 x f32:
-    /// let v: Vec<f32> = Standard.sample_iter(rng).take(16).collect();
+    /// let v: Vec<f32> = Standard.sample_iter(&mut rng).take(16).collect();
     ///
     /// // String:
-    /// let s: String = Alphanumeric.sample_iter(rng).take(7).collect();
+    /// let s: String = Alphanumeric.sample_iter(&mut rng).take(7).collect();
     ///
     /// // Dice-rolling:
     /// let die_range = Uniform::new_inclusive(1, 6);
-    /// let mut roll_die = die_range.sample_iter(rng);
+    /// let mut roll_die = die_range.sample_iter(&mut rng);
     /// while roll_die.next().unwrap() != 6 {
     ///     println!("Not a 6; rolling again!");
     /// }
     /// ```
-    fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
-    where
-        R: Rng,
-        Self: Sized,
+    fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>
+        where Self: Sized, R: Rng
     {
         DistIter {
             distr: self,
-            rng,
+            rng: rng,
             phantom: ::core::marker::PhantomData,
         }
     }
@@ -654,25 +893,20 @@
 ///
 /// [`sample_iter`]: Distribution::sample_iter
 #[derive(Debug)]
-pub struct DistIter<D, R, T> {
-    distr: D,
-    rng: R,
+pub struct DistIter<'a, D: 'a, R: 'a, T> {
+    distr: &'a D,
+    rng: &'a mut R,
     phantom: ::core::marker::PhantomData<T>,
 }
 
-impl<D, R, T> Iterator for DistIter<D, R, T>
-where
-    D: Distribution<T>,
-    R: Rng,
+impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T>
+    where D: Distribution<T>, R: Rng + 'a
 {
     type Item = T;
 
     #[inline(always)]
     fn next(&mut self) -> Option<T> {
-        // Here, self.rng may be a reference, but we must take &mut anyway.
-        // Even if sample could take an R: Rng by value, we would need to do this
-        // since Rng is not copyable and we cannot enforce that this is "reborrowable".
-        Some(self.distr.sample(&mut self.rng))
+        Some(self.distr.sample(self.rng))
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
@@ -680,27 +914,20 @@
     }
 }
 
-impl<D, R, T> iter::FusedIterator for DistIter<D, R, T>
-where
-    D: Distribution<T>,
-    R: Rng,
-{
-}
+#[cfg(rustc_1_26)]
+impl<'a, D, R, T> iter::FusedIterator for DistIter<'a, D, R, T>
+    where D: Distribution<T>, R: Rng + 'a {}
 
 #[cfg(features = "nightly")]
-impl<D, R, T> iter::TrustedLen for DistIter<D, R, T>
-where
-    D: Distribution<T>,
-    R: Rng,
-{
-}
+impl<'a, D, R, T> iter::TrustedLen for DistIter<'a, D, R, T>
+    where D: Distribution<T>, R: Rng + 'a {}
 
 
 /// A generic random value distribution, implemented for many primitive types.
 /// Usually generates values with a numerically uniform distribution, and with a
 /// range appropriate to the type.
 ///
-/// ## Provided implementations
+/// ## Built-in Implementations
 ///
 /// Assuming the provided `Rng` is well-behaved, these implementations
 /// generate values with the following ranges and distributions:
@@ -717,42 +944,20 @@
 /// * Wrapping integers (`Wrapping<T>`), besides the type identical to their
 ///   normal integer variants.
 ///
-/// The `Standard` distribution also supports generation of the following
-/// compound types where all component types are supported:
+/// The following aggregate types also implement the distribution `Standard` as
+/// long as their component types implement it:
 ///
-/// *   Tuples (up to 12 elements): each element is generated sequentially.
-/// *   Arrays (up to 32 elements): each element is generated sequentially;
-///     see also [`Rng::fill`] which supports arbitrary array length for integer
-///     types and tends to be faster for `u32` and smaller types.
-/// *   `Option<T>` first generates a `bool`, and if true generates and returns
-///     `Some(value)` where `value: T`, otherwise returning `None`.
+/// * Tuples and arrays: Each element of the tuple or array is generated
+///   independently, using the `Standard` distribution recursively.
+/// * `Option<T>` where `Standard` is implemented for `T`: Returns `None` with
+///   probability 0.5; otherwise generates a random `x: T` and returns `Some(x)`.
 ///
-/// ## Custom implementations
-///
-/// The [`Standard`] distribution may be implemented for user types as follows:
-///
-/// ```
-/// # #![allow(dead_code)]
-/// use rand::Rng;
-/// use rand::distributions::{Distribution, Standard};
-///
-/// struct MyF32 {
-///     x: f32,
-/// }
-///
-/// impl Distribution<MyF32> for Standard {
-///     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
-///         MyF32 { x: rng.gen() }
-///     }
-/// }
-/// ```
-///
-/// ## Example usage
+/// # Example
 /// ```
 /// use rand::prelude::*;
 /// use rand::distributions::Standard;
 ///
-/// let val: f32 = StdRng::from_entropy().sample(Standard);
+/// let val: f32 = SmallRng::from_entropy().sample(Standard);
 /// println!("f32 from [0, 1): {}", val);
 /// ```
 ///
@@ -761,7 +966,7 @@
 /// the half-open interval `[0, 1)`, i.e. including 0 but not 1.
 ///
 /// All values that can be generated are of the form `n * ε/2`. For `f32`
-/// the 24 most significant random bits of a `u32` are used and for `f64` the
+/// the 23 most significant random bits of a `u32` are used and for `f64` the
 /// 53 most significant bits of a `u64` are used. The conversion uses the
 /// multiplicative method: `(rng.gen::<$uty>() >> N) as $ty * (ε/2)`.
 ///
@@ -777,38 +982,237 @@
 pub struct Standard;
 
 
-#[cfg(all(test, feature = "std"))]
+/// A value with a particular weight for use with `WeightedChoice`.
+#[deprecated(since="0.6.0", note="use WeightedIndex instead")]
+#[allow(deprecated)]
+#[derive(Copy, Clone, Debug)]
+pub struct Weighted<T> {
+    /// The numerical weight of this item
+    pub weight: u32,
+    /// The actual item which is being weighted
+    pub item: T,
+}
+
+/// A distribution that selects from a finite collection of weighted items.
+///
+/// Deprecated: use [`WeightedIndex`] instead.
+///
+/// [`WeightedIndex`]: WeightedIndex
+#[deprecated(since="0.6.0", note="use WeightedIndex instead")]
+#[allow(deprecated)]
+#[derive(Debug)]
+pub struct WeightedChoice<'a, T:'a> {
+    items: &'a mut [Weighted<T>],
+    weight_range: Uniform<u32>,
+}
+
+#[deprecated(since="0.6.0", note="use WeightedIndex instead")]
+#[allow(deprecated)]
+impl<'a, T: Clone> WeightedChoice<'a, T> {
+    /// Create a new `WeightedChoice`.
+    ///
+    /// Panics if:
+    ///
+    /// - `items` is empty
+    /// - the total weight is 0
+    /// - the total weight is larger than a `u32` can contain.
+    pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
+        // strictly speaking, this is subsumed by the total weight == 0 case
+        assert!(!items.is_empty(), "WeightedChoice::new called with no items");
+
+        let mut running_total: u32 = 0;
+
+        // we convert the list from individual weights to cumulative
+        // weights so we can binary search. This *could* drop elements
+        // with weight == 0 as an optimisation.
+        for item in items.iter_mut() {
+            running_total = match running_total.checked_add(item.weight) {
+                Some(n) => n,
+                None => panic!("WeightedChoice::new called with a total weight \
+                               larger than a u32 can contain")
+            };
+
+            item.weight = running_total;
+        }
+        assert!(running_total != 0, "WeightedChoice::new called with a total weight of 0");
+
+        WeightedChoice {
+            items,
+            // we're likely to be generating numbers in this range
+            // relatively often, so might as well cache it
+            weight_range: Uniform::new(0, running_total)
+        }
+    }
+}
+
+#[deprecated(since="0.6.0", note="use WeightedIndex instead")]
+#[allow(deprecated)]
+impl<'a, T: Clone> Distribution<T> for WeightedChoice<'a, T> {
+    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T {
+        // we want to find the first element that has cumulative
+        // weight > sample_weight, which we do by binary since the
+        // cumulative weights of self.items are sorted.
+
+        // choose a weight in [0, total_weight)
+        let sample_weight = self.weight_range.sample(rng);
+
+        // short circuit when it's the first item
+        if sample_weight < self.items[0].weight {
+            return self.items[0].item.clone();
+        }
+
+        let mut idx = 0;
+        let mut modifier = self.items.len();
+
+        // now we know that every possibility has an element to the
+        // left, so we can just search for the last element that has
+        // cumulative weight <= sample_weight, then the next one will
+        // be "it". (Note that this greatest element will never be the
+        // last element of the vector, since sample_weight is chosen
+        // in [0, total_weight) and the cumulative weight of the last
+        // one is exactly the total weight.)
+        while modifier > 1 {
+            let i = idx + modifier / 2;
+            if self.items[i].weight <= sample_weight {
+                // we're small, so look to the right, but allow this
+                // exact element still.
+                idx = i;
+                // we need the `/ 2` to round up otherwise we'll drop
+                // the trailing elements when `modifier` is odd.
+                modifier += 1;
+            } else {
+                // otherwise we're too big, so go left. (i.e. do
+                // nothing)
+            }
+            modifier /= 2;
+        }
+        self.items[idx + 1].item.clone()
+    }
+}
+
+#[cfg(test)]
 mod tests {
-    use super::{Distribution, Uniform};
-    use crate::Rng;
+    use rngs::mock::StepRng;
+    #[allow(deprecated)]
+    use super::{WeightedChoice, Weighted, Distribution};
 
     #[test]
-    fn test_distributions_iter() {
-        use crate::distributions::Open01;
-        let mut rng = crate::test::rng(210);
-        let distr = Open01;
-        let results: Vec<f32> = distr.sample_iter(&mut rng).take(100).collect();
-        println!("{:?}", results);
+    #[allow(deprecated)]
+    fn test_weighted_choice() {
+        // this makes assumptions about the internal implementation of
+        // WeightedChoice. It may fail when the implementation in
+        // `distributions::uniform::UniformInt` changes.
+
+        macro_rules! t {
+            ($items:expr, $expected:expr) => {{
+                let mut items = $items;
+                let mut total_weight = 0;
+                for item in &items { total_weight += item.weight; }
+
+                let wc = WeightedChoice::new(&mut items);
+                let expected = $expected;
+
+                // Use extremely large steps between the random numbers, because
+                // we test with small ranges and `UniformInt` is designed to prefer
+                // the most significant bits.
+                let mut rng = StepRng::new(0, !0 / (total_weight as u64));
+
+                for &val in expected.iter() {
+                    assert_eq!(wc.sample(&mut rng), val)
+                }
+            }}
+        }
+
+        t!([Weighted { weight: 1, item: 10}], [10]);
+
+        // skip some
+        t!([Weighted { weight: 0, item: 20},
+            Weighted { weight: 2, item: 21},
+            Weighted { weight: 0, item: 22},
+            Weighted { weight: 1, item: 23}],
+           [21, 21, 23]);
+
+        // different weights
+        t!([Weighted { weight: 4, item: 30},
+            Weighted { weight: 3, item: 31}],
+           [30, 31, 30, 31, 30, 31, 30]);
+
+        // check that we're binary searching
+        // correctly with some vectors of odd
+        // length.
+        t!([Weighted { weight: 1, item: 40},
+            Weighted { weight: 1, item: 41},
+            Weighted { weight: 1, item: 42},
+            Weighted { weight: 1, item: 43},
+            Weighted { weight: 1, item: 44}],
+           [40, 41, 42, 43, 44]);
+        t!([Weighted { weight: 1, item: 50},
+            Weighted { weight: 1, item: 51},
+            Weighted { weight: 1, item: 52},
+            Weighted { weight: 1, item: 53},
+            Weighted { weight: 1, item: 54},
+            Weighted { weight: 1, item: 55},
+            Weighted { weight: 1, item: 56}],
+           [50, 54, 51, 55, 52, 56, 53]);
     }
 
     #[test]
-    fn test_make_an_iter() {
-        fn ten_dice_rolls_other_than_five<'a, R: Rng>(
-            rng: &'a mut R,
-        ) -> impl Iterator<Item = i32> + 'a {
-            Uniform::new_inclusive(1, 6)
-                .sample_iter(rng)
-                .filter(|x| *x != 5)
-                .take(10)
-        }
+    #[allow(deprecated)]
+    fn test_weighted_clone_initialization() {
+        let initial : Weighted<u32> = Weighted {weight: 1, item: 1};
+        let clone = initial.clone();
+        assert_eq!(initial.weight, clone.weight);
+        assert_eq!(initial.item, clone.item);
+    }
 
-        let mut rng = crate::test::rng(211);
-        let mut count = 0;
-        for val in ten_dice_rolls_other_than_five(&mut rng) {
-            assert!(val >= 1 && val <= 6 && val != 5);
-            count += 1;
-        }
-        assert_eq!(count, 10);
+    #[test] #[should_panic]
+    #[allow(deprecated)]
+    fn test_weighted_clone_change_weight() {
+        let initial : Weighted<u32> = Weighted {weight: 1, item: 1};
+        let mut clone = initial.clone();
+        clone.weight = 5;
+        assert_eq!(initial.weight, clone.weight);
+    }
+
+    #[test] #[should_panic]
+    #[allow(deprecated)]
+    fn test_weighted_clone_change_item() {
+        let initial : Weighted<u32> = Weighted {weight: 1, item: 1};
+        let mut clone = initial.clone();
+        clone.item = 5;
+        assert_eq!(initial.item, clone.item);
+
+    }
+
+    #[test] #[should_panic]
+    #[allow(deprecated)]
+    fn test_weighted_choice_no_items() {
+        WeightedChoice::<isize>::new(&mut []);
+    }
+    #[test] #[should_panic]
+    #[allow(deprecated)]
+    fn test_weighted_choice_zero_weight() {
+        WeightedChoice::new(&mut [Weighted { weight: 0, item: 0},
+                                  Weighted { weight: 0, item: 1}]);
+    }
+    #[test] #[should_panic]
+    #[allow(deprecated)]
+    fn test_weighted_choice_weight_overflows() {
+        let x = ::core::u32::MAX / 2; // x + x + 2 is the overflow
+        WeightedChoice::new(&mut [Weighted { weight: x, item: 0 },
+                                  Weighted { weight: 1, item: 1 },
+                                  Weighted { weight: x, item: 2 },
+                                  Weighted { weight: 1, item: 3 }]);
+    }
+
+    #[cfg(feature="std")]
+    #[test]
+    fn test_distributions_iter() {
+        use distributions::Normal;
+        let mut rng = ::test::rng(210);
+        let distr = Normal::new(10.0, 10.0);
+        let results: Vec<_> = distr.sample_iter(&mut rng).take(100).collect();
+        println!("{:?}", results);
     }
 }
 
diff --git a/src/rand/distributions/normal.rs.html b/src/rand/distributions/normal.rs.html index c361afc..285dd2f 100644 --- a/src/rand/distributions/normal.rs.html +++ b/src/rand/distributions/normal.rs.html @@ -1,4 +1,4 @@ -normal.rs.html -- source
  1
+normal.rs.html -- source
  1
   2
   3
   4
@@ -175,6 +175,26 @@
 175
 176
 177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -186,11 +206,10 @@
 // except according to those terms.
 
 //! The normal and derived distributions.
-#![allow(deprecated)]
 
-use crate::distributions::utils::ziggurat;
-use crate::distributions::{ziggurat_tables, Distribution, Open01};
-use crate::Rng;
+use Rng;
+use distributions::{ziggurat_tables, Distribution, Open01};
+use distributions::utils::ziggurat;
 
 /// Samples floating-point numbers according to the normal distribution
 /// `N(0, 1)` (a.k.a. a standard normal, or Gaussian). This is equivalent to
@@ -204,7 +223,15 @@
 ///       Generate Normal Random Samples*](
 ///       https://www.doornik.com/research/ziggurat.pdf).
 ///       Nuffield College, Oxford
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+/// ```
+/// use rand::prelude::*;
+/// use rand::distributions::StandardNormal;
+///
+/// let val: f64 = SmallRng::from_entropy().sample(StandardNormal);
+/// println!("{}", val);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct StandardNormal;
 
@@ -212,7 +239,7 @@
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64 {
         #[inline]
         fn pdf(x: f64) -> f64 {
-            (-x * x / 2.0).exp()
+            (-x*x/2.0).exp()
         }
         #[inline]
         fn zero_case<R: Rng + ?Sized>(rng: &mut R, u: f64) -> f64 {
@@ -233,21 +260,13 @@
                 y = y_.ln();
             }
 
-            if u < 0.0 {
-                x - ziggurat_tables::ZIG_NORM_R
-            } else {
-                ziggurat_tables::ZIG_NORM_R - x
-            }
+            if u < 0.0 { x - ziggurat_tables::ZIG_NORM_R } else { ziggurat_tables::ZIG_NORM_R - x }
         }
 
-        ziggurat(
-            rng,
-            true, // this is symmetric
-            &ziggurat_tables::ZIG_NORM_X,
-            &ziggurat_tables::ZIG_NORM_F,
-            pdf,
-            zero_case,
-        )
+        ziggurat(rng, true, // this is symmetric
+                 &ziggurat_tables::ZIG_NORM_X,
+                 &ziggurat_tables::ZIG_NORM_F,
+                 pdf, zero_case)
     }
 }
 
@@ -255,12 +274,22 @@
 ///
 /// This uses the ZIGNOR variant of the Ziggurat method, see [`StandardNormal`]
 /// for more details.
-///
+/// 
 /// Note that [`StandardNormal`] is an optimised implementation for mean 0, and
 /// standard deviation 1.
 ///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Normal, Distribution};
+///
+/// // mean 2, standard deviation 3
+/// let normal = Normal::new(2.0, 3.0);
+/// let v = normal.sample(&mut rand::thread_rng());
+/// println!("{} is from a N(2, 9) distribution", v)
+/// ```
+///
 /// [`StandardNormal`]: crate::distributions::StandardNormal
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
 #[derive(Clone, Copy, Debug)]
 pub struct Normal {
     mean: f64,
@@ -277,7 +306,10 @@
     #[inline]
     pub fn new(mean: f64, std_dev: f64) -> Normal {
         assert!(std_dev >= 0.0, "Normal::new called with `std_dev` < 0");
-        Normal { mean, std_dev }
+        Normal {
+            mean,
+            std_dev
+        }
     }
 }
 impl Distribution<f64> for Normal {
@@ -292,10 +324,20 @@
 ///
 /// If `X` is log-normal distributed, then `ln(X)` is `N(mean, std_dev**2)`
 /// distributed.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{LogNormal, Distribution};
+///
+/// // mean 2, standard deviation 3
+/// let log_normal = LogNormal::new(2.0, 3.0);
+/// let v = log_normal.sample(&mut rand::thread_rng());
+/// println!("{} is from an ln N(2, 9) distribution", v)
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct LogNormal {
-    norm: Normal,
+    norm: Normal
 }
 
 impl LogNormal {
@@ -308,9 +350,7 @@
     #[inline]
     pub fn new(mean: f64, std_dev: f64) -> LogNormal {
         assert!(std_dev >= 0.0, "LogNormal::new called with `std_dev` < 0");
-        LogNormal {
-            norm: Normal::new(mean, std_dev),
-        }
+        LogNormal { norm: Normal::new(mean, std_dev) }
     }
 }
 impl Distribution<f64> for LogNormal {
@@ -321,13 +361,13 @@
 
 #[cfg(test)]
 mod tests {
-    use super::{LogNormal, Normal};
-    use crate::distributions::Distribution;
+    use distributions::Distribution;
+    use super::{Normal, LogNormal};
 
     #[test]
     fn test_normal() {
         let norm = Normal::new(10.0, 10.0);
-        let mut rng = crate::test::rng(210);
+        let mut rng = ::test::rng(210);
         for _ in 0..1000 {
             norm.sample(&mut rng);
         }
@@ -342,7 +382,7 @@
     #[test]
     fn test_log_normal() {
         let lnorm = LogNormal::new(10.0, 10.0);
-        let mut rng = crate::test::rng(211);
+        let mut rng = ::test::rng(211);
         for _ in 0..1000 {
             lnorm.sample(&mut rng);
         }
diff --git a/src/rand/distributions/other.rs.html b/src/rand/distributions/other.rs.html
index f6f8fab..ada0b01 100644
--- a/src/rand/distributions/other.rs.html
+++ b/src/rand/distributions/other.rs.html
@@ -1,4 +1,4 @@
-other.rs.html -- source
  1
+other.rs.html -- source
  1
   2
   3
   4
@@ -217,78 +217,6 @@
 217
 218
 219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -303,21 +231,21 @@
 use core::char;
 use core::num::Wrapping;
 
-use crate::distributions::{Distribution, Standard, Uniform};
-use crate::Rng;
+use {Rng};
+use distributions::{Distribution, Standard, Uniform};
 
 // ----- Sampling distributions -----
 
 /// Sample a `char`, uniformly distributed over ASCII letters and numbers:
 /// a-z, A-Z and 0-9.
-///
+/// 
 /// # Example
 ///
 /// ```
 /// use std::iter;
 /// use rand::{Rng, thread_rng};
 /// use rand::distributions::Alphanumeric;
-///
+/// 
 /// let mut rng = thread_rng();
 /// let chars: String = iter::repeat(())
 ///         .map(|()| rng.sample(Alphanumeric))
@@ -355,7 +283,8 @@
 impl Distribution<char> for Alphanumeric {
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> char {
         const RANGE: u32 = 26 + 26 + 10;
-        const GEN_ASCII_STR_CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\
+        const GEN_ASCII_STR_CHARSET: &[u8] =
+            b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\
                 abcdefghijklmnopqrstuvwxyz\
                 0123456789";
         // We can pick from 62 characters. This is so close to a power of 2, 64,
@@ -365,7 +294,7 @@
         loop {
             let var = rng.next_u32() >> (32 - 6);
             if var < RANGE {
-                return GEN_ASCII_STR_CHARSET[var as usize] as char;
+                return GEN_ASCII_STR_CHARSET[var as usize] as char
             }
         }
     }
@@ -407,24 +336,21 @@
 }
 
 impl Distribution<()> for Standard {
-    #[allow(clippy::unused_unit)]
     #[inline]
-    fn sample<R: Rng + ?Sized>(&self, _: &mut R) -> () {
-        ()
-    }
+    fn sample<R: Rng + ?Sized>(&self, _: &mut R) -> () { () }
 }
-tuple_impl! {A}
-tuple_impl! {A, B}
-tuple_impl! {A, B, C}
-tuple_impl! {A, B, C, D}
-tuple_impl! {A, B, C, D, E}
-tuple_impl! {A, B, C, D, E, F}
-tuple_impl! {A, B, C, D, E, F, G}
-tuple_impl! {A, B, C, D, E, F, G, H}
-tuple_impl! {A, B, C, D, E, F, G, H, I}
-tuple_impl! {A, B, C, D, E, F, G, H, I, J}
-tuple_impl! {A, B, C, D, E, F, G, H, I, J, K}
-tuple_impl! {A, B, C, D, E, F, G, H, I, J, K, L}
+tuple_impl!{A}
+tuple_impl!{A, B}
+tuple_impl!{A, B, C}
+tuple_impl!{A, B, C, D}
+tuple_impl!{A, B, C, D, E}
+tuple_impl!{A, B, C, D, E, F}
+tuple_impl!{A, B, C, D, E, F, G}
+tuple_impl!{A, B, C, D, E, F, G, H}
+tuple_impl!{A, B, C, D, E, F, G, H, I}
+tuple_impl!{A, B, C, D, E, F, G, H, I, J}
+tuple_impl!{A, B, C, D, E, F, G, H, I, J, K}
+tuple_impl!{A, B, C, D, E, F, G, H, I, J, K, L}
 
 macro_rules! array_impl {
     // recursive, given at least one type parameter:
@@ -446,11 +372,9 @@
     };
 }
 
-array_impl! {32, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T,}
+array_impl!{32, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T,}
 
-impl<T> Distribution<Option<T>> for Standard
-where Standard: Distribution<T>
-{
+impl<T> Distribution<Option<T>> for Standard where Standard: Distribution<T> {
     #[inline]
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Option<T> {
         // UFCS is needed here: https://github.com/rust-lang/rust/issues/24066
@@ -462,9 +386,7 @@
     }
 }
 
-impl<T> Distribution<Wrapping<T>> for Standard
-where Standard: Distribution<T>
-{
+impl<T> Distribution<Wrapping<T>> for Standard where Standard: Distribution<T> {
     #[inline]
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Wrapping<T> {
         Wrapping(rng.gen())
@@ -474,36 +396,34 @@
 
 #[cfg(test)]
 mod tests {
-    use super::*;
-    use crate::RngCore;
-    #[cfg(all(not(feature = "std"), feature = "alloc"))] use alloc::string::String;
+    use {Rng, RngCore, Standard};
+    use distributions::Alphanumeric;
+    #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::string::String;
 
     #[test]
     fn test_misc() {
-        let rng: &mut dyn RngCore = &mut crate::test::rng(820);
-
+        let rng: &mut RngCore = &mut ::test::rng(820);
+        
         rng.sample::<char, _>(Standard);
         rng.sample::<bool, _>(Standard);
     }
-
-    #[cfg(feature = "alloc")]
+    
+    #[cfg(feature="alloc")]
     #[test]
     fn test_chars() {
         use core::iter;
-        let mut rng = crate::test::rng(805);
+        let mut rng = ::test::rng(805);
 
         // Test by generating a relatively large number of chars, so we also
         // take the rejection sampling path.
         let word: String = iter::repeat(())
-            .map(|()| rng.gen::<char>())
-            .take(1000)
-            .collect();
+                .map(|()| rng.gen::<char>()).take(1000).collect();
         assert!(word.len() != 0);
     }
 
     #[test]
     fn test_alphanumeric() {
-        let mut rng = crate::test::rng(806);
+        let mut rng = ::test::rng(806);
 
         // Test by generating a relatively large number of chars, so we also
         // take the rejection sampling path.
@@ -516,70 +436,6 @@
         }
         assert!(incorrect == false);
     }
-
-    #[test]
-    fn value_stability() {
-        fn test_samples<T: Copy + core::fmt::Debug + PartialEq, D: Distribution<T>>(
-            distr: &D, zero: T, expected: &[T],
-        ) {
-            let mut rng = crate::test::rng(807);
-            let mut buf = [zero; 5];
-            for x in &mut buf {
-                *x = rng.sample(&distr);
-            }
-            assert_eq!(&buf, expected);
-        }
-
-        test_samples(&Standard, 'a', &[
-            '\u{8cdac}',
-            '\u{a346a}',
-            '\u{80120}',
-            '\u{ed692}',
-            '\u{35888}',
-        ]);
-        test_samples(&Alphanumeric, 'a', &['h', 'm', 'e', '3', 'M']);
-        test_samples(&Standard, false, &[true, true, false, true, false]);
-        test_samples(&Standard, None as Option<bool>, &[
-            Some(true),
-            None,
-            Some(false),
-            None,
-            Some(false),
-        ]);
-        test_samples(&Standard, Wrapping(0i32), &[
-            Wrapping(-2074640887),
-            Wrapping(-1719949321),
-            Wrapping(2018088303),
-            Wrapping(-547181756),
-            Wrapping(838957336),
-        ]);
-
-        // We test only sub-sets of tuple and array impls
-        test_samples(&Standard, (), &[(), (), (), (), ()]);
-        test_samples(&Standard, (false,), &[
-            (true,),
-            (true,),
-            (false,),
-            (true,),
-            (false,),
-        ]);
-        test_samples(&Standard, (false, false), &[
-            (true, true),
-            (false, true),
-            (false, false),
-            (true, false),
-            (false, false),
-        ]);
-
-        test_samples(&Standard, [0u8; 0], &[[], [], [], [], []]);
-        test_samples(&Standard, [0u8; 3], &[
-            [9, 247, 111],
-            [68, 24, 13],
-            [174, 19, 194],
-            [172, 69, 213],
-            [149, 207, 29],
-        ]);
-    }
 }
 
\ No newline at end of file diff --git a/src/rand/distributions/pareto.rs.html b/src/rand/distributions/pareto.rs.html index f1bd03f..9caba0f 100644 --- a/src/rand/distributions/pareto.rs.html +++ b/src/rand/distributions/pareto.rs.html @@ -1,4 +1,4 @@ -pareto.rs.html -- source
 1
+pareto.rs.html -- source
 1
  2
  3
  4
@@ -68,6 +68,10 @@
 68
 69
 70
+71
+72
+73
+74
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -78,13 +82,20 @@
 // except according to those terms.
 
 //! The Pareto distribution.
-#![allow(deprecated)]
 
-use crate::distributions::{Distribution, OpenClosed01};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, OpenClosed01};
 
 /// Samples floating-point numbers according to the Pareto distribution
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+/// ```
+/// use rand::prelude::*;
+/// use rand::distributions::Pareto;
+///
+/// let val: f64 = SmallRng::from_entropy().sample(Pareto::new(1., 2.));
+/// println!("{}", val);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Pareto {
     scale: f64,
@@ -102,10 +113,7 @@
     /// `scale` and `shape` have to be non-zero and positive.
     pub fn new(scale: f64, shape: f64) -> Pareto {
         assert!((scale > 0.) & (shape > 0.));
-        Pareto {
-            scale,
-            inv_neg_shape: -1.0 / shape,
-        }
+        Pareto { scale, inv_neg_shape: -1.0 / shape }
     }
 }
 
@@ -118,8 +126,8 @@
 
 #[cfg(test)]
 mod tests {
+    use distributions::Distribution;
     use super::Pareto;
-    use crate::distributions::Distribution;
 
     #[test]
     #[should_panic]
@@ -132,7 +140,7 @@
         let scale = 1.0;
         let shape = 2.0;
         let d = Pareto::new(scale, shape);
-        let mut rng = crate::test::rng(1);
+        let mut rng = ::test::rng(1);
         for _ in 0..1000 {
             let r = d.sample(&mut rng);
             assert!(r >= scale);
diff --git a/src/rand/distributions/poisson.rs.html b/src/rand/distributions/poisson.rs.html
index 4474555..ebfefa5 100644
--- a/src/rand/distributions/poisson.rs.html
+++ b/src/rand/distributions/poisson.rs.html
@@ -1,4 +1,4 @@
-poisson.rs.html -- source
  1
+poisson.rs.html -- source
  1
   2
   3
   4
@@ -149,6 +149,12 @@
 149
 150
 151
+152
+153
+154
+155
+156
+157
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2016-2017 The Rust Project Developers.
@@ -160,17 +166,25 @@
 // except according to those terms.
 
 //! The Poisson distribution.
-#![allow(deprecated)]
 
-use crate::distributions::utils::log_gamma;
-use crate::distributions::{Cauchy, Distribution};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, Cauchy};
+use distributions::utils::log_gamma;
 
 /// The Poisson distribution `Poisson(lambda)`.
 ///
 /// This distribution has a density function:
 /// `f(k) = lambda^k * exp(-lambda) / k!` for `k >= 0`.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{Poisson, Distribution};
+///
+/// let poi = Poisson::new(2.0);
+/// let v = poi.sample(&mut rand::thread_rng());
+/// println!("{} is from a Poisson(2) distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Poisson {
     lambda: f64,
@@ -242,8 +256,7 @@
                 // the magic value scales the distribution function to a range of approximately 0-1
                 // since it is not exact, we multiply the ratio by 0.9 to avoid ratios greater than 1
                 // this doesn't change the resulting distribution, only increases the rate of failed drawings
-                let check = 0.9
-                    * (1.0 + comp_dev * comp_dev)
+                let check = 0.9 * (1.0 + comp_dev * comp_dev)
                     * (result * self.log_lambda - log_gamma(1.0 + result) - self.magic_val).exp();
 
                 // check with uniform random value - if below the threshold, we are within the target distribution
@@ -258,14 +271,13 @@
 
 #[cfg(test)]
 mod test {
+    use distributions::Distribution;
     use super::Poisson;
-    use crate::distributions::Distribution;
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_poisson_10() {
         let poisson = Poisson::new(10.0);
-        let mut rng = crate::test::rng(123);
+        let mut rng = ::test::rng(123);
         let mut sum = 0;
         for _ in 0..1000 {
             sum += poisson.sample(&mut rng);
@@ -279,7 +291,7 @@
     fn test_poisson_15() {
         // Take the 'high expected values' path
         let poisson = Poisson::new(15.0);
-        let mut rng = crate::test::rng(123);
+        let mut rng = ::test::rng(123);
         let mut sum = 0;
         for _ in 0..1000 {
             sum += poisson.sample(&mut rng);
diff --git a/src/rand/distributions/triangular.rs.html b/src/rand/distributions/triangular.rs.html
index 66cc6a3..d3b7937 100644
--- a/src/rand/distributions/triangular.rs.html
+++ b/src/rand/distributions/triangular.rs.html
@@ -1,4 +1,4 @@
-triangular.rs.html -- source
 1
+triangular.rs.html -- source
 1
  2
  3
  4
@@ -81,6 +81,9 @@
 81
 82
 83
+84
+85
+86
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -89,15 +92,22 @@
 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-
 //! The triangular distribution.
-#![allow(deprecated)]
 
-use crate::distributions::{Distribution, Standard};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, Standard};
 
 /// The triangular distribution.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+///
+/// ```rust
+/// use rand::distributions::{Triangular, Distribution};
+///
+/// let d = Triangular::new(0., 5., 2.5);
+/// let v = d.sample(&mut rand::thread_rng());
+/// println!("{} is from a triangular distribution", v);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Triangular {
     min: f64,
@@ -112,6 +122,7 @@
     /// # Panics
     ///
     /// If `max < mode`, `mode < max` or `max == min`.
+    ///
     #[inline]
     pub fn new(min: f64, max: f64, mode: f64) -> Triangular {
         assert!(max >= mode);
@@ -137,19 +148,14 @@
 
 #[cfg(test)]
 mod test {
+    use distributions::Distribution;
     use super::Triangular;
-    use crate::distributions::Distribution;
 
     #[test]
     fn test_new() {
         for &(min, max, mode) in &[
-            (-1., 1., 0.),
-            (1., 2., 1.),
-            (5., 25., 25.),
-            (1e-5, 1e5, 1e-3),
-            (0., 1., 0.9),
-            (-4., -0.5, -2.),
-            (-13.039, 8.41, 1.17),
+            (-1., 1., 0.), (1., 2., 1.), (5., 25., 25.), (1e-5, 1e5, 1e-3),
+            (0., 1., 0.9), (-4., -0.5, -2.), (-13.039, 8.41, 1.17),
         ] {
             println!("{} {} {}", min, max, mode);
             let _ = Triangular::new(min, max, mode);
@@ -159,7 +165,7 @@
     #[test]
     fn test_sample() {
         let norm = Triangular::new(0., 1., 0.5);
-        let mut rng = crate::test::rng(1);
+        let mut rng = ::test::rng(1);
         for _ in 0..1000 {
             norm.sample(&mut rng);
         }
diff --git a/src/rand/distributions/uniform.rs.html b/src/rand/distributions/uniform.rs.html
index 517cb30..839d1aa 100644
--- a/src/rand/distributions/uniform.rs.html
+++ b/src/rand/distributions/uniform.rs.html
@@ -1,4 +1,4 @@
-uniform.rs.html -- source
   1
+uniform.rs.html -- source
   1
    2
    3
    4
@@ -1281,103 +1281,6 @@
 1281
 1282
 1283
-1284
-1285
-1286
-1287
-1288
-1289
-1290
-1291
-1292
-1293
-1294
-1295
-1296
-1297
-1298
-1299
-1300
-1301
-1302
-1303
-1304
-1305
-1306
-1307
-1308
-1309
-1310
-1311
-1312
-1313
-1314
-1315
-1316
-1317
-1318
-1319
-1320
-1321
-1322
-1323
-1324
-1325
-1326
-1327
-1328
-1329
-1330
-1331
-1332
-1333
-1334
-1335
-1336
-1337
-1338
-1339
-1340
-1341
-1342
-1343
-1344
-1345
-1346
-1347
-1348
-1349
-1350
-1351
-1352
-1353
-1354
-1355
-1356
-1357
-1358
-1359
-1360
-1361
-1362
-1363
-1364
-1365
-1366
-1367
-1368
-1369
-1370
-1371
-1372
-1373
-1374
-1375
-1376
-1377
-1378
-1379
-1380
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2017 The Rust Project Developers.
@@ -1447,7 +1350,9 @@
 //! struct MyF32(f32);
 //!
 //! #[derive(Clone, Copy, Debug)]
-//! struct UniformMyF32(UniformFloat<f32>);
+//! struct UniformMyF32 {
+//!     inner: UniformFloat<f32>,
+//! }
 //!
 //! impl UniformSampler for UniformMyF32 {
 //!     type X = MyF32;
@@ -1455,7 +1360,9 @@
 //!         where B1: SampleBorrow<Self::X> + Sized,
 //!               B2: SampleBorrow<Self::X> + Sized
 //!     {
-//!         UniformMyF32(UniformFloat::<f32>::new(low.borrow().0, high.borrow().0))
+//!         UniformMyF32 {
+//!             inner: UniformFloat::<f32>::new(low.borrow().0, high.borrow().0),
+//!         }
 //!     }
 //!     fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
 //!         where B1: SampleBorrow<Self::X> + Sized,
@@ -1464,7 +1371,7 @@
 //!         UniformSampler::new(low, high)
 //!     }
 //!     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
-//!         MyF32(self.0.sample(rng))
+//!         MyF32(self.inner.sample(rng))
 //!     }
 //! }
 //!
@@ -1484,20 +1391,23 @@
 //! [`UniformDuration`]: crate::distributions::uniform::UniformDuration
 //! [`SampleBorrow::borrow`]: crate::distributions::uniform::SampleBorrow::borrow
 
-#[cfg(not(feature = "std"))] use core::time::Duration;
-#[cfg(feature = "std")] use std::time::Duration;
+#[cfg(feature = "std")]
+use std::time::Duration;
+#[cfg(all(not(feature = "std"), rustc_1_25))]
+use core::time::Duration;
 
-use crate::distributions::float::IntoFloat;
-use crate::distributions::utils::{BoolAsSIMD, FloatAsSIMD, FloatSIMDUtils, WideningMultiply};
-use crate::distributions::Distribution;
-use crate::Rng;
+use Rng;
+use distributions::Distribution;
+use distributions::float::IntoFloat;
+use distributions::utils::{WideningMultiply, FloatSIMDUtils, FloatAsSIMD, BoolAsSIMD};
 
 #[cfg(not(feature = "std"))]
 #[allow(unused_imports)] // rustc doesn't detect that this is actually used
-use crate::distributions::utils::Float;
+use distributions::utils::Float;
 
 
-#[cfg(feature = "simd_support")] use packed_simd::*;
+#[cfg(feature="simd_support")]
+use packed_simd::*;
 
 /// Sample values uniformly between two bounds.
 ///
@@ -1540,33 +1450,33 @@
 /// [`new`]: Uniform::new
 /// [`new_inclusive`]: Uniform::new_inclusive
 #[derive(Clone, Copy, Debug)]
-pub struct Uniform<X: SampleUniform>(X::Sampler);
+pub struct Uniform<X: SampleUniform> {
+    inner: X::Sampler,
+}
 
 impl<X: SampleUniform> Uniform<X> {
     /// Create a new `Uniform` instance which samples uniformly from the half
     /// open range `[low, high)` (excluding `high`). Panics if `low >= high`.
     pub fn new<B1, B2>(low: B1, high: B2) -> Uniform<X>
-    where
-        B1: SampleBorrow<X> + Sized,
-        B2: SampleBorrow<X> + Sized,
+        where B1: SampleBorrow<X> + Sized,
+              B2: SampleBorrow<X> + Sized
     {
-        Uniform(X::Sampler::new(low, high))
+        Uniform { inner: X::Sampler::new(low, high) }
     }
 
     /// Create a new `Uniform` instance which samples uniformly from the closed
     /// range `[low, high]` (inclusive). Panics if `low > high`.
     pub fn new_inclusive<B1, B2>(low: B1, high: B2) -> Uniform<X>
-    where
-        B1: SampleBorrow<X> + Sized,
-        B2: SampleBorrow<X> + Sized,
+        where B1: SampleBorrow<X> + Sized,
+              B2: SampleBorrow<X> + Sized
     {
-        Uniform(X::Sampler::new_inclusive(low, high))
+        Uniform { inner: X::Sampler::new_inclusive(low, high) }
     }
 }
 
 impl<X: SampleUniform> Distribution<X> for Uniform<X> {
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> X {
-        self.0.sample(rng)
+        self.inner.sample(rng)
     }
 }
 
@@ -1602,9 +1512,8 @@
     /// Usually users should not call this directly but instead use
     /// `Uniform::new`, which asserts that `low < high` before calling this.
     fn new<B1, B2>(low: B1, high: B2) -> Self
-    where
-        B1: SampleBorrow<Self::X> + Sized,
-        B2: SampleBorrow<Self::X> + Sized;
+        where B1: SampleBorrow<Self::X> + Sized,
+              B2: SampleBorrow<Self::X> + Sized;
 
     /// Construct self, with inclusive bounds `[low, high]`.
     ///
@@ -1612,9 +1521,8 @@
     /// `Uniform::new_inclusive`, which asserts that `low <= high` before
     /// calling this.
     fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
-    where
-        B1: SampleBorrow<Self::X> + Sized,
-        B2: SampleBorrow<Self::X> + Sized;
+        where B1: SampleBorrow<Self::X> + Sized,
+              B2: SampleBorrow<Self::X> + Sized;
 
     /// Sample a value.
     fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X;
@@ -1622,26 +1530,18 @@
     /// Sample a single value uniformly from a range with inclusive lower bound
     /// and exclusive upper bound `[low, high)`.
     ///
-    /// By default this is implemented using
-    /// `UniformSampler::new(low, high).sample(rng)`. However, for some types
-    /// more optimal implementations for single usage may be provided via this
-    /// method (which is the case for integers and floats).
-    /// Results may not be identical.
+    /// Usually users should not call this directly but instead use
+    /// `Uniform::sample_single`, which asserts that `low < high` before calling
+    /// this.
     ///
-    /// Note that to use this method in a generic context, the type needs to be
-    /// retrieved via `SampleUniform::Sampler` as follows:
-    /// ```
-    /// use rand::{thread_rng, distributions::uniform::{SampleUniform, UniformSampler}};
-    /// # #[allow(unused)]
-    /// fn sample_from_range<T: SampleUniform>(lb: T, ub: T) -> T {
-    ///     let mut rng = thread_rng();
-    ///     <T as SampleUniform>::Sampler::sample_single(lb, ub, &mut rng)
-    /// }
-    /// ```
-    fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X
-    where
-        B1: SampleBorrow<Self::X> + Sized,
-        B2: SampleBorrow<Self::X> + Sized,
+    /// Via this method, implementations can provide a method optimized for
+    /// sampling only a single value from the specified range. The default
+    /// implementation simply calls `UniformSampler::new` then `sample` on the
+    /// result.
+    fn sample_single<R: Rng + ?Sized, B1, B2>(low: B1, high: B2, rng: &mut R)
+        -> Self::X
+        where B1: SampleBorrow<Self::X> + Sized,
+              B2: SampleBorrow<Self::X> + Sized
     {
         let uniform: Self = UniformSampler::new(low, high);
         uniform.sample(rng)
@@ -1654,6 +1554,7 @@
     }
 }
 
+#[cfg(rustc_1_27)]
 impl<X: SampleUniform> From<::core::ops::RangeInclusive<X>> for Uniform<X> {
     fn from(r: ::core::ops::RangeInclusive<X>) -> Uniform<X> {
         Uniform::new_inclusive(r.start(), r.end())
@@ -1671,21 +1572,13 @@
     /// [`Borrow::borrow`]: std::borrow::Borrow::borrow
     fn borrow(&self) -> &Borrowed;
 }
-impl<Borrowed> SampleBorrow<Borrowed> for Borrowed
-where Borrowed: SampleUniform
-{
+impl<Borrowed> SampleBorrow<Borrowed> for Borrowed where Borrowed: SampleUniform {
     #[inline(always)]
-    fn borrow(&self) -> &Borrowed {
-        self
-    }
+    fn borrow(&self) -> &Borrowed { self }
 }
-impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed
-where Borrowed: SampleUniform
-{
+impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed where Borrowed: SampleUniform {
     #[inline(always)]
-    fn borrow(&self) -> &Borrowed {
-        *self
-    }
+   fn borrow(&self) -> &Borrowed { *self }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1700,29 +1593,31 @@
 ///
 /// # Implementation notes
 ///
-/// For simplicity, we use the same generic struct `UniformInt<X>` for all
-/// integer types `X`. This gives us only one field type, `X`; to store unsigned
-/// values of this size, we take use the fact that these conversions are no-ops.
-///
 /// For a closed range, the number of possible numbers we should generate is
-/// `range = (high - low + 1)`. To avoid bias, we must ensure that the size of
-/// our sample space, `zone`, is a multiple of `range`; other values must be
-/// rejected (by replacing with a new random sample).
+/// `range = (high - low + 1)`. It is not possible to end up with a uniform
+/// distribution if we map *all* the random integers that can be generated to
+/// this range. We have to map integers from a `zone` that is a multiple of the
+/// range. The rest of the integers, that cause a bias, are rejected.
 ///
-/// As a special case, we use `range = 0` to represent the full range of the
-/// result type (i.e. for `new_inclusive($ty::MIN, $ty::MAX)`).
+/// The problem with `range` is that to cover the full range of the type, it has
+/// to store `unsigned_max + 1`, which can't be represented. But if the range
+/// covers the full range of the type, no modulus is needed. A range of size 0
+/// can't exist, so we use that to represent this special case. Wrapping
+/// arithmetic even makes representing `unsigned_max + 1` as 0 simple.
 ///
-/// The optimum `zone` is the largest product of `range` which fits in our
-/// (unsigned) target type. We calculate this by calculating how many numbers we
-/// must reject: `reject = (MAX + 1) % range = (MAX - range + 1) % range`. Any (large)
-/// product of `range` will suffice, thus in `sample_single` we multiply by a
-/// power of 2 via bit-shifting (faster but may cause more rejections).
+/// We don't calculate `zone` directly, but first calculate the number of
+/// integers to reject. To handle `unsigned_max + 1` not fitting in the type,
+/// we use:
+/// `ints_to_reject = (unsigned_max + 1) % range;`
+/// `ints_to_reject = (unsigned_max - range + 1) % range;`
 ///
-/// The smallest integer PRNGs generate is `u32`. For 8- and 16-bit outputs we
-/// use `u32` for our `zone` and samples (because it's not slower and because
-/// it reduces the chance of having to reject a sample). In this case we cannot
-/// store `zone` in the target type since it is too large, however we know
-/// `ints_to_reject < range <= $unsigned::MAX`.
+/// The smallest integer PRNGs generate is `u32`. That is why for small integer
+/// sizes (`i8`/`u8` and `i16`/`u16`) there is an optimization: don't pick the
+/// largest zone that can fit in the small type, but pick the largest zone that
+/// can fit in an `u32`. `ints_to_reject` is always less than half the size of
+/// the small integer. This means the first bit of `zone` is always 1, and so
+/// are all the other preceding bits of a larger integer. The easiest way to
+/// grow the `zone` for the larger type is to simply sign extend it.
 ///
 /// An alternative to using a modulus is widening multiply: After a widening
 /// multiply by `range`, the result is in the high word. Then comparing the low
@@ -1731,11 +1626,12 @@
 pub struct UniformInt<X> {
     low: X,
     range: X,
-    z: X, // either ints_to_reject or zone depending on implementation
+    zone: X,
 }
 
 macro_rules! uniform_int_impl {
-    ($ty:ty, $unsigned:ident, $u_large:ident) => {
+    ($ty:ty, $signed:ty, $unsigned:ident,
+     $i_large:ident, $u_large:ident) => {
         impl SampleUniform for $ty {
             type Sampler = UniformInt<$ty>;
         }
@@ -1751,9 +1647,8 @@
             #[inline] // if the range is constant, this helps LLVM to do the
                       // calculations at compile-time.
             fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
@@ -1764,39 +1659,41 @@
             #[inline] // if the range is constant, this helps LLVM to do the
                       // calculations at compile-time.
             fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
-                assert!(
-                    low <= high,
-                    "Uniform::new_inclusive called with `low > high`"
-                );
-                let unsigned_max = ::core::$u_large::MAX;
+                assert!(low <= high,
+                        "Uniform::new_inclusive called with `low > high`");
+                let unsigned_max = ::core::$unsigned::MAX;
 
                 let range = high.wrapping_sub(low).wrapping_add(1) as $unsigned;
-                let ints_to_reject = if range > 0 {
-                    let range = $u_large::from(range);
-                    (unsigned_max - range + 1) % range
-                } else {
-                    0
-                };
+                let ints_to_reject =
+                    if range > 0 {
+                        (unsigned_max - range + 1) % range
+                    } else {
+                        0
+                    };
+                let zone = unsigned_max - ints_to_reject;
 
                 UniformInt {
                     low: low,
                     // These are really $unsigned values, but store as $ty:
                     range: range as $ty,
-                    z: ints_to_reject as $unsigned as $ty,
+                    zone: zone as $ty
                 }
             }
 
             fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
                 let range = self.range as $unsigned as $u_large;
                 if range > 0 {
-                    let unsigned_max = ::core::$u_large::MAX;
-                    let zone = unsigned_max - (self.z as $unsigned as $u_large);
+                    // Grow `zone` to fit a type of at least 32 bits, by
+                    // sign-extending it (the first bit is always 1, so are all
+                    // the preceding bits of the larger type).
+                    // For types that already have the right size, all the
+                    // casting is a no-op.
+                    let zone = self.zone as $signed as $i_large as $u_large;
                     loop {
                         let v: $u_large = rng.gen();
                         let (hi, lo) = v.wmul(range);
@@ -1810,27 +1707,29 @@
                 }
             }
 
-            fn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Self::X
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+            fn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R)
+                -> Self::X
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
-                assert!(low < high, "UniformSampler::sample_single: low >= high");
+                assert!(low < high,
+                        "Uniform::sample_single called with low >= high");
                 let range = high.wrapping_sub(low) as $unsigned as $u_large;
-                let zone = if ::core::$unsigned::MAX <= ::core::u16::MAX as $unsigned {
-                    // Using a modulus is faster than the approximation for
-                    // i8 and i16. I suppose we trade the cost of one
-                    // modulus for near-perfect branch prediction.
-                    let unsigned_max: $u_large = ::core::$u_large::MAX;
-                    let ints_to_reject = (unsigned_max - range + 1) % range;
-                    unsigned_max - ints_to_reject
-                } else {
-                    // conservative but fast approximation. `- 1` is necessary to allow the
-                    // same comparison without bias.
-                    (range << range.leading_zeros()).wrapping_sub(1)
-                };
+                let zone =
+                    if ::core::$unsigned::MAX <= ::core::u16::MAX as $unsigned {
+                        // Using a modulus is faster than the approximation for
+                        // i8 and i16. I suppose we trade the cost of one
+                        // modulus for near-perfect branch prediction.
+                        let unsigned_max: $u_large = ::core::$u_large::MAX;
+                        let ints_to_reject = (unsigned_max - range + 1) % range;
+                        unsigned_max - ints_to_reject
+                    } else {
+                        // conservative but fast approximation. `- 1` is necessary to allow the
+                        // same comparison without bias.
+                        (range << range.leading_zeros()).wrapping_sub(1)
+                    };
 
                 loop {
                     let v: $u_large = rng.gen();
@@ -1841,23 +1740,23 @@
                 }
             }
         }
-    };
+    }
 }
 
-uniform_int_impl! { i8, u8, u32 }
-uniform_int_impl! { i16, u16, u32 }
-uniform_int_impl! { i32, u32, u32 }
-uniform_int_impl! { i64, u64, u64 }
-#[cfg(not(target_os = "emscripten"))]
-uniform_int_impl! { i128, u128, u128 }
-uniform_int_impl! { isize, usize, usize }
-uniform_int_impl! { u8, u8, u32 }
-uniform_int_impl! { u16, u16, u32 }
-uniform_int_impl! { u32, u32, u32 }
-uniform_int_impl! { u64, u64, u64 }
-uniform_int_impl! { usize, usize, usize }
-#[cfg(not(target_os = "emscripten"))]
-uniform_int_impl! { u128, u128, u128 }
+uniform_int_impl! { i8, i8, u8, i32, u32 }
+uniform_int_impl! { i16, i16, u16, i32, u32 }
+uniform_int_impl! { i32, i32, u32, i32, u32 }
+uniform_int_impl! { i64, i64, u64, i64, u64 }
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
+uniform_int_impl! { i128, i128, u128, u128, u128 }
+uniform_int_impl! { isize, isize, usize, isize, usize }
+uniform_int_impl! { u8, i8, u8, i32, u32 }
+uniform_int_impl! { u16, i16, u16, i32, u32 }
+uniform_int_impl! { u32, i32, u32, i32, u32 }
+uniform_int_impl! { u64, i64, u64, i64, u64 }
+uniform_int_impl! { usize, isize, usize, isize, usize }
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
+uniform_int_impl! { u128, u128, u128, i128, u128 }
 
 #[cfg(all(feature = "simd_support", feature = "nightly"))]
 macro_rules! uniform_simd_int_impl {
@@ -1919,13 +1818,13 @@
                     low: low,
                     // These are really $unsigned values, but store as $ty:
                     range: range.cast(),
-                    z: zone.cast(),
+                    zone: zone.cast(),
                 }
             }
 
             fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
                 let range: $unsigned = self.range.cast();
-                let zone: $unsigned = self.z.cast();
+                let zone: $unsigned = self.zone.cast();
 
                 // This might seem very slow, generating a whole new
                 // SIMD vector for every sample rejection. For most uses
@@ -2018,7 +1917,7 @@
 ///
 /// The floats are first converted to a value in the `[1, 2)` interval using a
 /// transmute-based method, and then mapped to the expected range with a
-/// multiply and addition. Values produced this way have what equals 23 bits of
+/// multiply and addition. Values produced this way have what equals 22 bits of
 /// random digits for an `f32`, and 52 for an `f64`.
 ///
 /// [`new`]: UniformSampler::new
@@ -2040,20 +1939,17 @@
             type X = $ty;
 
             fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
-                assert!(low.all_lt(high), "Uniform::new called with `low >= high`");
-                assert!(
-                    low.all_finite() && high.all_finite(),
-                    "Uniform::new called with non-finite boundaries"
-                );
-                let max_rand = <$ty>::splat(
-                    (::core::$u_scalar::MAX >> $bits_to_discard).into_float_with_exponent(0) - 1.0,
-                );
+                assert!(low.all_lt(high),
+                        "Uniform::new called with `low >= high`");
+                assert!(low.all_finite() && high.all_finite(),
+                        "Uniform::new called with non-finite boundaries");
+                let max_rand = <$ty>::splat((::core::$u_scalar::MAX >> $bits_to_discard)
+                                            .into_float_with_exponent(0) - 1.0);
 
                 let mut scale = high - low;
 
@@ -2071,23 +1967,17 @@
             }
 
             fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
-                assert!(
-                    low.all_le(high),
-                    "Uniform::new_inclusive called with `low > high`"
-                );
-                assert!(
-                    low.all_finite() && high.all_finite(),
-                    "Uniform::new_inclusive called with non-finite boundaries"
-                );
-                let max_rand = <$ty>::splat(
-                    (::core::$u_scalar::MAX >> $bits_to_discard).into_float_with_exponent(0) - 1.0,
-                );
+                assert!(low.all_le(high),
+                        "Uniform::new_inclusive called with `low > high`");
+                assert!(low.all_finite() && high.all_finite(),
+                        "Uniform::new_inclusive called with non-finite boundaries");
+                let max_rand = <$ty>::splat((::core::$u_scalar::MAX >> $bits_to_discard)
+                                            .into_float_with_exponent(0) - 1.0);
 
                 let mut scale = (high - low) / max_rand;
 
@@ -2106,7 +1996,8 @@
 
             fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
                 // Generate a value in the range [1, 2)
-                let value1_2 = (rng.gen::<$uty>() >> $bits_to_discard).into_float_with_exponent(0);
+                let value1_2 = (rng.gen::<$uty>() >> $bits_to_discard)
+                               .into_float_with_exponent(0);
 
                 // Get a value in the range [0, 1) in order to avoid
                 // overflowing into infinity when multiplying with scale
@@ -2121,23 +2012,21 @@
             }
 
             #[inline]
-            fn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R) -> Self::X
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+            fn sample_single<R: Rng + ?Sized, B1, B2>(low_b: B1, high_b: B2, rng: &mut R)
+                -> Self::X
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 let low = *low_b.borrow();
                 let high = *high_b.borrow();
-                assert!(
-                    low.all_lt(high),
-                    "UniformSampler::sample_single: low >= high"
-                );
+                assert!(low.all_lt(high),
+                        "Uniform::sample_single called with low >= high");
                 let mut scale = high - low;
 
                 loop {
                     // Generate a value in the range [1, 2)
-                    let value1_2 =
-                        (rng.gen::<$uty>() >> $bits_to_discard).into_float_with_exponent(0);
+                    let value1_2 = (rng.gen::<$uty>() >> $bits_to_discard)
+                                   .into_float_with_exponent(0);
 
                     // Get a value in the range [0, 1) in order to avoid
                     // overflowing into infinity when multiplying with scale
@@ -2181,48 +2070,49 @@
                     // rare, so handle it here after the common case.
                     let mask = !scale.finite_mask();
                     if mask.any() {
-                        assert!(
-                            low.all_finite() && high.all_finite(),
-                            "Uniform::sample_single: low and high must be finite"
-                        );
+                        assert!(low.all_finite() && high.all_finite(),
+                                "Uniform::sample_single called with non-finite boundaries");
                         scale = scale.decrease_masked(mask);
                     }
                 }
             }
         }
-    };
+    }
 }
 
 uniform_float_impl! { f32, u32, f32, u32, 32 - 23 }
 uniform_float_impl! { f64, u64, f64, u64, 64 - 52 }
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f32x2, u32x2, f32, u32, 32 - 23 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f32x4, u32x4, f32, u32, 32 - 23 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f32x8, u32x8, f32, u32, 32 - 23 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f32x16, u32x16, f32, u32, 32 - 23 }
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f64x2, u64x2, f64, u64, 64 - 52 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f64x4, u64x4, f64, u64, 64 - 52 }
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 uniform_float_impl! { f64x8, u64x8, f64, u64, 64 - 52 }
 
 
+
 /// The back-end implementing [`UniformSampler`] for `Duration`.
 ///
 /// Unless you are implementing [`UniformSampler`] for your own types, this type
 /// should not be used directly, use [`Uniform`] instead.
+#[cfg(any(feature = "std", rustc_1_25))]
 #[derive(Clone, Copy, Debug)]
 pub struct UniformDuration {
     mode: UniformDurationMode,
     offset: u32,
 }
 
+#[cfg(any(feature = "std", rustc_1_25))]
 #[derive(Debug, Copy, Clone)]
 enum UniformDurationMode {
     Small {
@@ -2236,21 +2126,22 @@
         max_secs: u64,
         max_nanos: u32,
         secs: Uniform<u64>,
-    },
+    }
 }
 
+#[cfg(any(feature = "std", rustc_1_25))]
 impl SampleUniform for Duration {
     type Sampler = UniformDuration;
 }
 
+#[cfg(any(feature = "std", rustc_1_25))]
 impl UniformSampler for UniformDuration {
     type X = Duration;
 
     #[inline]
     fn new<B1, B2>(low_b: B1, high_b: B2) -> Self
-    where
-        B1: SampleBorrow<Self::X> + Sized,
-        B2: SampleBorrow<Self::X> + Sized,
+        where B1: SampleBorrow<Self::X> + Sized,
+              B2: SampleBorrow<Self::X> + Sized
     {
         let low = *low_b.borrow();
         let high = *high_b.borrow();
@@ -2260,16 +2151,12 @@
 
     #[inline]
     fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> Self
-    where
-        B1: SampleBorrow<Self::X> + Sized,
-        B2: SampleBorrow<Self::X> + Sized,
+        where B1: SampleBorrow<Self::X> + Sized,
+              B2: SampleBorrow<Self::X> + Sized
     {
         let low = *low_b.borrow();
         let high = *high_b.borrow();
-        assert!(
-            low <= high,
-            "Uniform::new_inclusive called with `low > high`"
-        );
+        assert!(low <= high, "Uniform::new_inclusive called with `low > high`");
 
         let low_s = low.as_secs();
         let low_n = low.subsec_nanos();
@@ -2277,8 +2164,8 @@
         let mut high_n = high.subsec_nanos();
 
         if high_n < low_n {
-            high_s -= 1;
-            high_n += 1_000_000_000;
+            high_s = high_s - 1;
+            high_n = high_n + 1_000_000_000;
         }
 
         let mode = if low_s == high_s {
@@ -2289,10 +2176,10 @@
         } else {
             let max = high_s
                 .checked_mul(1_000_000_000)
-                .and_then(|n| n.checked_add(u64::from(high_n)));
+                .and_then(|n| n.checked_add(high_n as u64));
 
             if let Some(higher_bound) = max {
-                let lower_bound = low_s * 1_000_000_000 + u64::from(low_n);
+                let lower_bound = low_s * 1_000_000_000 + low_n as u64;
                 UniformDurationMode::Medium {
                     nanos: Uniform::new_inclusive(lower_bound, higher_bound),
                 }
@@ -2323,11 +2210,7 @@
                 let nanos = nanos.sample(rng);
                 Duration::new(nanos / 1_000_000_000, (nanos % 1_000_000_000) as u32)
             }
-            UniformDurationMode::Large {
-                max_secs,
-                max_nanos,
-                secs,
-            } => {
+            UniformDurationMode::Large { max_secs, max_nanos, secs } => {
                 // constant folding means this is at least as fast as `gen_range`
                 let nano_range = Uniform::new(0, 1_000_000_000);
                 loop {
@@ -2345,8 +2228,11 @@
 
 #[cfg(test)]
 mod tests {
-    use super::*;
-    use crate::rngs::mock::StepRng;
+    use Rng;
+    use rngs::mock::StepRng;
+    use distributions::uniform::Uniform;
+    use distributions::utils::FloatAsSIMD;
+    #[cfg(feature="simd_support")] use packed_simd::*;
 
     #[should_panic]
     #[test]
@@ -2356,7 +2242,7 @@
 
     #[test]
     fn test_uniform_good_limits_equal_int() {
-        let mut rng = crate::test::rng(804);
+        let mut rng = ::test::rng(804);
         let dist = Uniform::new_inclusive(10, 10);
         for _ in 0..20 {
             assert_eq!(rng.sample(dist), 10);
@@ -2370,13 +2256,13 @@
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_integers() {
-        #[cfg(not(target_os = "emscripten"))] use core::{i128, u128};
-        use core::{i16, i32, i64, i8, isize};
-        use core::{u16, u32, u64, u8, usize};
+        use core::{i8, i16, i32, i64, isize};
+        use core::{u8, u16, u32, u64, usize};
+        #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
+        use core::{i128, u128};
 
-        let mut rng = crate::test::rng(251);
+        let mut rng = ::test::rng(251);
         macro_rules! t {
             ($ty:ident, $v:expr, $le:expr, $lt:expr) => {{
                 for &(low, high) in $v.iter() {
@@ -2435,8 +2321,9 @@
                 );)*
             }};
         }
-        t!(i8, i16, i32, i64, isize, u8, u16, u32, u64, usize);
-        #[cfg(not(target_os = "emscripten"))]
+        t!(i8, i16, i32, i64, isize,
+           u8, u16, u32, u64, usize);
+        #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
         t!(i128, u128);
 
         #[cfg(all(feature = "simd_support", feature = "nightly"))]
@@ -2453,29 +2340,28 @@
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_floats() {
-        let mut rng = crate::test::rng(252);
+        let mut rng = ::test::rng(252);
         let mut zero_rng = StepRng::new(0, 0);
         let mut max_rng = StepRng::new(0xffff_ffff_ffff_ffff, 0);
         macro_rules! t {
             ($ty:ty, $f_scalar:ident, $bits_shifted:expr) => {{
-                let v: &[($f_scalar, $f_scalar)] = &[
-                    (0.0, 100.0),
-                    (-1e35, -1e25),
-                    (1e-35, 1e-25),
-                    (-1e35, 1e35),
-                    (<$f_scalar>::from_bits(0), <$f_scalar>::from_bits(3)),
-                    (-<$f_scalar>::from_bits(10), -<$f_scalar>::from_bits(1)),
-                    (-<$f_scalar>::from_bits(5), 0.0),
-                    (-<$f_scalar>::from_bits(7), -0.0),
-                    (10.0, ::core::$f_scalar::MAX),
-                    (-100.0, ::core::$f_scalar::MAX),
-                    (-::core::$f_scalar::MAX / 5.0, ::core::$f_scalar::MAX),
-                    (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX / 5.0),
-                    (-::core::$f_scalar::MAX * 0.8, ::core::$f_scalar::MAX * 0.7),
-                    (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX),
-                ];
+                let v: &[($f_scalar, $f_scalar)]=
+                    &[(0.0, 100.0),
+                      (-1e35, -1e25),
+                      (1e-35, 1e-25),
+                      (-1e35, 1e35),
+                      (<$f_scalar>::from_bits(0), <$f_scalar>::from_bits(3)),
+                      (-<$f_scalar>::from_bits(10), -<$f_scalar>::from_bits(1)),
+                      (-<$f_scalar>::from_bits(5), 0.0),
+                      (-<$f_scalar>::from_bits(7), -0.0),
+                      (10.0, ::core::$f_scalar::MAX),
+                      (-100.0, ::core::$f_scalar::MAX),
+                      (-::core::$f_scalar::MAX / 5.0, ::core::$f_scalar::MAX),
+                      (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX / 5.0),
+                      (-::core::$f_scalar::MAX * 0.8, ::core::$f_scalar::MAX * 0.7),
+                      (-::core::$f_scalar::MAX, ::core::$f_scalar::MAX),
+                     ];
                 for &(low_scalar, high_scalar) in v.iter() {
                     for lane in 0..<$ty>::lanes() {
                         let low = <$ty>::splat(0.0 as $f_scalar).replace(lane, low_scalar);
@@ -2491,10 +2377,7 @@
                             assert!(low_scalar <= v && v < high_scalar);
                         }
 
-                        assert_eq!(
-                            rng.sample(Uniform::new_inclusive(low, low)).extract(lane),
-                            low_scalar
-                        );
+                        assert_eq!(rng.sample(Uniform::new_inclusive(low, low)).extract(lane), low_scalar);
 
                         assert_eq!(zero_rng.sample(my_uniform).extract(lane), low_scalar);
                         assert_eq!(zero_rng.sample(my_incl_uniform).extract(lane), low_scalar);
@@ -2506,37 +2389,26 @@
                         // since for those rounding might result in selecting high for a very
                         // long time.
                         if (high_scalar - low_scalar) > 0.0001 {
-                            let mut lowering_max_rng = StepRng::new(
-                                0xffff_ffff_ffff_ffff,
-                                (-1i64 << $bits_shifted) as u64,
-                            );
-                            assert!(
-                                lowering_max_rng.gen_range(low, high).extract(lane) < high_scalar
-                            );
+                            let mut lowering_max_rng =
+                                StepRng::new(0xffff_ffff_ffff_ffff,
+                                             (-1i64 << $bits_shifted) as u64);
+                            assert!(lowering_max_rng.gen_range(low, high).extract(lane) < high_scalar);
                         }
                     }
                 }
 
-                assert_eq!(
-                    rng.sample(Uniform::new_inclusive(
-                        ::core::$f_scalar::MAX,
-                        ::core::$f_scalar::MAX
-                    )),
-                    ::core::$f_scalar::MAX
-                );
-                assert_eq!(
-                    rng.sample(Uniform::new_inclusive(
-                        -::core::$f_scalar::MAX,
-                        -::core::$f_scalar::MAX
-                    )),
-                    -::core::$f_scalar::MAX
-                );
-            }};
+                assert_eq!(rng.sample(Uniform::new_inclusive(::core::$f_scalar::MAX,
+                                                             ::core::$f_scalar::MAX)),
+                           ::core::$f_scalar::MAX);
+                assert_eq!(rng.sample(Uniform::new_inclusive(-::core::$f_scalar::MAX,
+                                                             -::core::$f_scalar::MAX)),
+                           -::core::$f_scalar::MAX);
+            }}
         }
 
         t!(f32, f32, 32 - 23);
         t!(f64, f64, 64 - 52);
-        #[cfg(feature = "simd_support")]
+        #[cfg(feature="simd_support")]
         {
             t!(f32x2, f32, 32 - 23);
             t!(f32x4, f32, 32 - 23);
@@ -2549,38 +2421,33 @@
     }
 
     #[test]
-    #[cfg(all(
-        feature = "std",
-        not(target_arch = "wasm32"),
-        not(target_arch = "asmjs")
-    ))]
+    #[cfg(all(feature="std",
+              not(target_arch = "wasm32"),
+              not(target_arch = "asmjs")))]
     fn test_float_assertions() {
-        use super::SampleUniform;
         use std::panic::catch_unwind;
+        use super::SampleUniform;
         fn range<T: SampleUniform>(low: T, high: T) {
-            let mut rng = crate::test::rng(253);
+            let mut rng = ::test::rng(253);
             rng.gen_range(low, high);
         }
 
         macro_rules! t {
             ($ty:ident, $f_scalar:ident) => {{
-                let v: &[($f_scalar, $f_scalar)] = &[
-                    (::std::$f_scalar::NAN, 0.0),
-                    (1.0, ::std::$f_scalar::NAN),
-                    (::std::$f_scalar::NAN, ::std::$f_scalar::NAN),
-                    (1.0, 0.5),
-                    (::std::$f_scalar::MAX, -::std::$f_scalar::MAX),
-                    (::std::$f_scalar::INFINITY, ::std::$f_scalar::INFINITY),
-                    (
-                        ::std::$f_scalar::NEG_INFINITY,
-                        ::std::$f_scalar::NEG_INFINITY,
-                    ),
-                    (::std::$f_scalar::NEG_INFINITY, 5.0),
-                    (5.0, ::std::$f_scalar::INFINITY),
-                    (::std::$f_scalar::NAN, ::std::$f_scalar::INFINITY),
-                    (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::NAN),
-                    (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::INFINITY),
-                ];
+                let v: &[($f_scalar, $f_scalar)] =
+                    &[(::std::$f_scalar::NAN, 0.0),
+                      (1.0, ::std::$f_scalar::NAN),
+                      (::std::$f_scalar::NAN, ::std::$f_scalar::NAN),
+                      (1.0, 0.5),
+                      (::std::$f_scalar::MAX, -::std::$f_scalar::MAX),
+                      (::std::$f_scalar::INFINITY, ::std::$f_scalar::INFINITY),
+                      (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::NEG_INFINITY),
+                      (::std::$f_scalar::NEG_INFINITY, 5.0),
+                      (5.0, ::std::$f_scalar::INFINITY),
+                      (::std::$f_scalar::NAN, ::std::$f_scalar::INFINITY),
+                      (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::NAN),
+                      (::std::$f_scalar::NEG_INFINITY, ::std::$f_scalar::INFINITY),
+                     ];
                 for &(low_scalar, high_scalar) in v.iter() {
                     for lane in 0..<$ty>::lanes() {
                         let low = <$ty>::splat(0.0 as $f_scalar).replace(lane, low_scalar);
@@ -2592,12 +2459,12 @@
                         assert!(catch_unwind(|| Uniform::new(low, low)).is_err());
                     }
                 }
-            }};
+            }}
         }
 
         t!(f32, f32);
         t!(f64, f64);
-        #[cfg(feature = "simd_support")]
+        #[cfg(feature="simd_support")]
         {
             t!(f32x2, f32);
             t!(f32x4, f32);
@@ -2611,21 +2478,18 @@
 
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
+    #[cfg(any(feature = "std", rustc_1_25))]
     fn test_durations() {
-        #[cfg(not(feature = "std"))] use core::time::Duration;
-        #[cfg(feature = "std")] use std::time::Duration;
+        #[cfg(feature = "std")]
+        use std::time::Duration;
+        #[cfg(all(not(feature = "std"), rustc_1_25))]
+        use core::time::Duration;
 
-        let mut rng = crate::test::rng(253);
+        let mut rng = ::test::rng(253);
 
-        let v = &[
-            (Duration::new(10, 50000), Duration::new(100, 1234)),
-            (Duration::new(0, 100), Duration::new(1, 50)),
-            (
-                Duration::new(0, 0),
-                Duration::new(u64::max_value(), 999_999_999),
-            ),
-        ];
+        let v = &[(Duration::new(10, 50000), Duration::new(100, 1234)),
+                  (Duration::new(0, 100), Duration::new(1, 50)),
+                  (Duration::new(0, 0), Duration::new(u64::max_value(), 999_999_999))];
         for &(low, high) in v.iter() {
             let my_uniform = Uniform::new(low, high);
             for _ in 0..1000 {
@@ -2637,47 +2501,42 @@
 
     #[test]
     fn test_custom_uniform() {
-        use crate::distributions::uniform::{
-            SampleBorrow, SampleUniform, UniformFloat, UniformSampler,
-        };
+        use distributions::uniform::{UniformSampler, UniformFloat, SampleUniform, SampleBorrow};
         #[derive(Clone, Copy, PartialEq, PartialOrd)]
         struct MyF32 {
             x: f32,
         }
         #[derive(Clone, Copy, Debug)]
-        struct UniformMyF32(UniformFloat<f32>);
+        struct UniformMyF32 {
+            inner: UniformFloat<f32>,
+        }
         impl UniformSampler for UniformMyF32 {
             type X = MyF32;
-
             fn new<B1, B2>(low: B1, high: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
-                UniformMyF32(UniformFloat::<f32>::new(low.borrow().x, high.borrow().x))
+                UniformMyF32 {
+                    inner: UniformFloat::<f32>::new(low.borrow().x, high.borrow().x),
+                }
             }
-
             fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
-            where
-                B1: SampleBorrow<Self::X> + Sized,
-                B2: SampleBorrow<Self::X> + Sized,
+                where B1: SampleBorrow<Self::X> + Sized,
+                      B2: SampleBorrow<Self::X> + Sized
             {
                 UniformSampler::new(low, high)
             }
-
             fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
-                MyF32 {
-                    x: self.0.sample(rng),
-                }
+                MyF32 { x: self.inner.sample(rng) }
             }
         }
         impl SampleUniform for MyF32 {
             type Sampler = UniformMyF32;
         }
 
-        let (low, high) = (MyF32 { x: 17.0f32 }, MyF32 { x: 22.0f32 });
+        let (low, high) = (MyF32{ x: 17.0f32 }, MyF32{ x: 22.0f32 });
         let uniform = Uniform::new(low, high);
-        let mut rng = crate::test::rng(804);
+        let mut rng = ::test::rng(804);
         for _ in 0..100 {
             let x: MyF32 = rng.sample(uniform);
             assert!(low <= x && x < high);
@@ -2687,76 +2546,23 @@
     #[test]
     fn test_uniform_from_std_range() {
         let r = Uniform::from(2u32..7);
-        assert_eq!(r.0.low, 2);
-        assert_eq!(r.0.range, 5);
+        assert_eq!(r.inner.low, 2);
+        assert_eq!(r.inner.range, 5);
         let r = Uniform::from(2.0f64..7.0);
-        assert_eq!(r.0.low, 2.0);
-        assert_eq!(r.0.scale, 5.0);
+        assert_eq!(r.inner.low, 2.0);
+        assert_eq!(r.inner.scale, 5.0);
     }
 
+    #[cfg(rustc_1_27)]
     #[test]
     fn test_uniform_from_std_range_inclusive() {
         let r = Uniform::from(2u32..=6);
-        assert_eq!(r.0.low, 2);
-        assert_eq!(r.0.range, 5);
+        assert_eq!(r.inner.low, 2);
+        assert_eq!(r.inner.range, 5);
         let r = Uniform::from(2.0f64..=7.0);
-        assert_eq!(r.0.low, 2.0);
-        assert!(r.0.scale > 5.0);
-        assert!(r.0.scale < 5.0 + 1e-14);
-    }
-
-    #[test]
-    fn value_stability() {
-        fn test_samples<T: SampleUniform + Copy + core::fmt::Debug + PartialEq>(
-            lb: T, ub: T, expected_single: &[T], expected_multiple: &[T],
-        ) where Uniform<T>: Distribution<T> {
-            let mut rng = crate::test::rng(897);
-            let mut buf = [lb; 3];
-
-            for x in &mut buf {
-                *x = T::Sampler::sample_single(lb, ub, &mut rng);
-            }
-            assert_eq!(&buf, expected_single);
-
-            let distr = Uniform::new(lb, ub);
-            for x in &mut buf {
-                *x = rng.sample(&distr);
-            }
-            assert_eq!(&buf, expected_multiple);
-        }
-
-        // We test on a sub-set of types; possibly we should do more.
-        // TODO: SIMD types
-
-        test_samples(11u8, 219, &[17, 66, 214], &[181, 93, 165]);
-        test_samples(11u32, 219, &[17, 66, 214], &[181, 93, 165]);
-
-        test_samples(0f32, 1e-2f32, &[0.0003070104, 0.0026630748, 0.00979833], &[
-            0.008194133,
-            0.00398172,
-            0.007428536,
-        ]);
-        test_samples(
-            -1e10f64,
-            1e10f64,
-            &[-4673848682.871551, 6388267422.932352, 4857075081.198343],
-            &[1173375212.1808167, 1917642852.109581, 2365076174.3153973],
-        );
-
-        test_samples(
-            Duration::new(2, 0),
-            Duration::new(4, 0),
-            &[
-                Duration::new(2, 532615131),
-                Duration::new(3, 638826742),
-                Duration::new(3, 485707508),
-            ],
-            &[
-                Duration::new(3, 117337521),
-                Duration::new(3, 191764285),
-                Duration::new(3, 236507617),
-            ],
-        );
+        assert_eq!(r.inner.low, 2.0);
+        assert!(r.inner.scale > 5.0);
+        assert!(r.inner.scale < 5.0 + 1e-14);
     }
 }
 
diff --git a/src/rand/distributions/unit_circle.rs.html b/src/rand/distributions/unit_circle.rs.html index be99f7f..eb395b8 100644 --- a/src/rand/distributions/unit_circle.rs.html +++ b/src/rand/distributions/unit_circle.rs.html @@ -1,4 +1,4 @@ -unit_circle.rs.html -- source
  1
+unit_circle.rs.html -- source
  1
   2
   3
   4
@@ -99,7 +99,6 @@
  99
 100
 101
-102
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -109,21 +108,28 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(deprecated)]
-#![allow(clippy::all)]
-
-use crate::distributions::{Distribution, Uniform};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, Uniform};
 
 /// Samples uniformly from the edge of the unit circle in two dimensions.
 ///
 /// Implemented via a method by von Neumann[^1].
 ///
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{UnitCircle, Distribution};
+///
+/// let circle = UnitCircle::new();
+/// let v = circle.sample(&mut rand::thread_rng());
+/// println!("{:?} is from the unit circle.", v)
+/// ```
+///
 /// [^1]: von Neumann, J. (1951) [*Various Techniques Used in Connection with
 ///       Random Digits.*](https://mcnp.lanl.gov/pdf_files/nbs_vonneumann.pdf)
 ///       NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing
 ///       Office, pp. 36-38.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
 #[derive(Clone, Copy, Debug)]
 pub struct UnitCircle;
 
@@ -145,62 +151,54 @@
         loop {
             x1 = uniform.sample(rng);
             x2 = uniform.sample(rng);
-            sum = x1 * x1 + x2 * x2;
+            sum = x1*x1 + x2*x2;
             if sum < 1. {
                 break;
             }
         }
-        let diff = x1 * x1 - x2 * x2;
-        [diff / sum, 2. * x1 * x2 / sum]
+        let diff = x1*x1 - x2*x2;
+        [diff / sum, 2.*x1*x2 / sum]
     }
 }
 
 #[cfg(test)]
 mod tests {
+    use distributions::Distribution;
     use super::UnitCircle;
-    use crate::distributions::Distribution;
 
     /// Assert that two numbers are almost equal to each other.
     ///
     /// On panic, this macro will print the values of the expressions with their
     /// debug representations.
     macro_rules! assert_almost_eq {
-        ($a:expr, $b:expr, $prec:expr) => {
+        ($a:expr, $b:expr, $prec:expr) => (
             let diff = ($a - $b).abs();
             if diff > $prec {
                 panic!(format!(
                     "assertion failed: `abs(left - right) = {:.1e} < {:e}`, \
                      (left: `{}`, right: `{}`)",
-                    diff, $prec, $a, $b
-                ));
+                    diff, $prec, $a, $b));
             }
-        };
+        );
     }
 
     #[test]
     fn norm() {
-        let mut rng = crate::test::rng(1);
+        let mut rng = ::test::rng(1);
         let dist = UnitCircle::new();
         for _ in 0..1000 {
             let x = dist.sample(&mut rng);
-            assert_almost_eq!(x[0] * x[0] + x[1] * x[1], 1., 1e-15);
+            assert_almost_eq!(x[0]*x[0] + x[1]*x[1], 1., 1e-15);
         }
     }
 
     #[test]
     fn value_stability() {
-        let mut rng = crate::test::rng(2);
-        let expected = [
-            [-0.9965658683520504, -0.08280380447614634],
-            [-0.9790853270389644, -0.20345004884984505],
-            [-0.8449189758898707, 0.5348943112253227],
-        ];
-        let samples = [
-            UnitCircle.sample(&mut rng),
-            UnitCircle.sample(&mut rng),
-            UnitCircle.sample(&mut rng),
-        ];
-        assert_eq!(samples, expected);
+        let mut rng = ::test::rng(2);
+        let dist = UnitCircle::new();
+        assert_eq!(dist.sample(&mut rng), [-0.8032118336637037, 0.5956935036263119]);
+        assert_eq!(dist.sample(&mut rng), [-0.4742919588505423, -0.880367615130018]);
+        assert_eq!(dist.sample(&mut rng), [0.9297328981467168, 0.368234623716601]);
     }
 }
 
diff --git a/src/rand/distributions/unit_sphere.rs.html b/src/rand/distributions/unit_sphere.rs.html index 026cbe9..8501184 100644 --- a/src/rand/distributions/unit_sphere.rs.html +++ b/src/rand/distributions/unit_sphere.rs.html @@ -1,4 +1,4 @@ -unit_sphere.rs.html -- source
 1
+unit_sphere.rs.html -- source
 1
  2
  3
  4
@@ -95,6 +95,8 @@
 95
 96
 97
+98
+99
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -104,20 +106,27 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(deprecated)]
-#![allow(clippy::all)]
-
-use crate::distributions::{Distribution, Uniform};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, Uniform};
 
 /// Samples uniformly from the surface of the unit sphere in three dimensions.
 ///
 /// Implemented via a method by Marsaglia[^1].
 ///
+///
+/// # Example
+///
+/// ```
+/// use rand::distributions::{UnitSphereSurface, Distribution};
+///
+/// let sphere = UnitSphereSurface::new();
+/// let v = sphere.sample(&mut rand::thread_rng());
+/// println!("{:?} is from the unit sphere surface.", v)
+/// ```
+///
 /// [^1]: Marsaglia, George (1972). [*Choosing a Point from the Surface of a
 ///       Sphere.*](https://doi.org/10.1214/aoms/1177692644)
 ///       Ann. Math. Statist. 43, no. 2, 645--646.
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
 #[derive(Clone, Copy, Debug)]
 pub struct UnitSphereSurface;
 
@@ -135,62 +144,57 @@
         let uniform = Uniform::new(-1., 1.);
         loop {
             let (x1, x2) = (uniform.sample(rng), uniform.sample(rng));
-            let sum = x1 * x1 + x2 * x2;
+            let sum = x1*x1 + x2*x2;
             if sum >= 1. {
                 continue;
             }
             let factor = 2. * (1.0_f64 - sum).sqrt();
-            return [x1 * factor, x2 * factor, 1. - 2. * sum];
+            return [x1 * factor, x2 * factor, 1. - 2.*sum];
         }
     }
 }
 
 #[cfg(test)]
 mod tests {
+    use distributions::Distribution;
     use super::UnitSphereSurface;
-    use crate::distributions::Distribution;
 
     /// Assert that two numbers are almost equal to each other.
     ///
     /// On panic, this macro will print the values of the expressions with their
     /// debug representations.
     macro_rules! assert_almost_eq {
-        ($a:expr, $b:expr, $prec:expr) => {
+        ($a:expr, $b:expr, $prec:expr) => (
             let diff = ($a - $b).abs();
             if diff > $prec {
                 panic!(format!(
                     "assertion failed: `abs(left - right) = {:.1e} < {:e}`, \
                      (left: `{}`, right: `{}`)",
-                    diff, $prec, $a, $b
-                ));
+                    diff, $prec, $a, $b));
             }
-        };
+        );
     }
 
     #[test]
     fn norm() {
-        let mut rng = crate::test::rng(1);
+        let mut rng = ::test::rng(1);
         let dist = UnitSphereSurface::new();
         for _ in 0..1000 {
             let x = dist.sample(&mut rng);
-            assert_almost_eq!(x[0] * x[0] + x[1] * x[1] + x[2] * x[2], 1., 1e-15);
+            assert_almost_eq!(x[0]*x[0] + x[1]*x[1] + x[2]*x[2], 1., 1e-15);
         }
     }
 
     #[test]
     fn value_stability() {
-        let mut rng = crate::test::rng(2);
-        let expected = [
-            [0.03247542860231647, -0.7830477442152738, 0.6211131755296027],
-            [-0.09978440840914075, 0.9706650829833128, -0.21875184231323952],
-            [0.2735582468624679, 0.9435374242279655, -0.1868234852870203],
-        ];
-        let samples = [
-            UnitSphereSurface.sample(&mut rng),
-            UnitSphereSurface.sample(&mut rng),
-            UnitSphereSurface.sample(&mut rng),
-        ];
-        assert_eq!(samples, expected);
+        let mut rng = ::test::rng(2);
+        let dist = UnitSphereSurface::new();
+        assert_eq!(dist.sample(&mut rng),
+                   [-0.24950027180862533, -0.7552572587896719, 0.6060825747478084]);
+        assert_eq!(dist.sample(&mut rng),
+                   [0.47604534507233487, -0.797200864987207, -0.3712837328763685]);
+        assert_eq!(dist.sample(&mut rng),
+                   [0.9795722330927367, 0.18692349236651176, 0.07414747571708524]);
     }
 }
 
diff --git a/src/rand/distributions/utils.rs.html b/src/rand/distributions/utils.rs.html index 68265f5..81fa898 100644 --- a/src/rand/distributions/utils.rs.html +++ b/src/rand/distributions/utils.rs.html @@ -1,4 +1,4 @@ -utils.rs.html -- source
  1
+utils.rs.html -- source
  1
   2
   3
   4
@@ -502,49 +502,6 @@
 502
 503
 504
-505
-506
-507
-508
-509
-510
-511
-512
-513
-514
-515
-516
-517
-518
-519
-520
-521
-522
-523
-524
-525
-526
-527
-528
-529
-530
-531
-532
-533
-534
-535
-536
-537
-538
-539
-540
-541
-542
-543
-544
-545
-546
-547
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -556,9 +513,12 @@
 
 //! Math helper functions
 
-#[cfg(feature = "std")] use crate::distributions::ziggurat_tables;
-#[cfg(feature = "std")] use crate::Rng;
-#[cfg(feature = "simd_support")] use packed_simd::*;
+#[cfg(feature="simd_support")]
+use packed_simd::*;
+#[cfg(feature="std")]
+use distributions::ziggurat_tables;
+#[cfg(feature="std")]
+use Rng;
 
 
 pub trait WideningMultiply<RHS = Self> {
@@ -606,7 +566,7 @@
 wmul_impl! { u8, u16, 8 }
 wmul_impl! { u16, u32, 16 }
 wmul_impl! { u32, u64, 32 }
-#[cfg(not(target_os = "emscripten"))]
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
 wmul_impl! { u64, u128, 64 }
 
 // This code is a translation of the __mulddi3 function in LLVM's
@@ -670,9 +630,9 @@
         )+
     };
 }
-#[cfg(target_os = "emscripten")]
+#[cfg(not(all(rustc_1_26, not(target_os = "emscripten"))))]
 wmul_impl_large! { u64, 32 }
-#[cfg(not(target_os = "emscripten"))]
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
 wmul_impl_large! { u128, 64 }
 
 macro_rules! wmul_impl_usize {
@@ -686,7 +646,7 @@
                 (high as usize, low as usize)
             }
         }
-    };
+    }
 }
 #[cfg(target_pointer_width = "32")]
 wmul_impl_usize! { u32 }
@@ -695,9 +655,11 @@
 
 #[cfg(all(feature = "simd_support", feature = "nightly"))]
 mod simd_wmul {
+    #[cfg(target_arch = "x86")]
+    use core::arch::x86::*;
+    #[cfg(target_arch = "x86_64")]
+    use core::arch::x86_64::*;
     use super::*;
-    #[cfg(target_arch = "x86")] use core::arch::x86::*;
-    #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*;
 
     wmul_impl! {
         (u8x2, u16x2),
@@ -791,35 +753,29 @@
 
 /// Implement functions available in std builds but missing from core primitives
 #[cfg(not(std))]
-pub(crate) trait Float: Sized {
+pub(crate) trait Float : Sized {
+    type Bits;
+
     fn is_nan(self) -> bool;
     fn is_infinite(self) -> bool;
     fn is_finite(self) -> bool;
+    fn to_bits(self) -> Self::Bits;
+    fn from_bits(v: Self::Bits) -> Self;
 }
 
 /// Implement functions on f32/f64 to give them APIs similar to SIMD types
-pub(crate) trait FloatAsSIMD: Sized {
+pub(crate) trait FloatAsSIMD : Sized {
     #[inline(always)]
-    fn lanes() -> usize {
-        1
-    }
+    fn lanes() -> usize { 1 }
     #[inline(always)]
-    fn splat(scalar: Self) -> Self {
-        scalar
-    }
+    fn splat(scalar: Self) -> Self { scalar }
     #[inline(always)]
-    fn extract(self, index: usize) -> Self {
-        debug_assert_eq!(index, 0);
-        self
-    }
+    fn extract(self, index: usize) -> Self { debug_assert_eq!(index, 0); self }
     #[inline(always)]
-    fn replace(self, index: usize, new_value: Self) -> Self {
-        debug_assert_eq!(index, 0);
-        new_value
-    }
+    fn replace(self, index: usize, new_value: Self) -> Self { debug_assert_eq!(index, 0); new_value }
 }
 
-pub(crate) trait BoolAsSIMD: Sized {
+pub(crate) trait BoolAsSIMD : Sized {
     fn any(self) -> bool;
     fn all(self) -> bool;
     fn none(self) -> bool;
@@ -827,25 +783,19 @@
 
 impl BoolAsSIMD for bool {
     #[inline(always)]
-    fn any(self) -> bool {
-        self
-    }
-
+    fn any(self) -> bool { self }
     #[inline(always)]
-    fn all(self) -> bool {
-        self
-    }
-
+    fn all(self) -> bool { self }
     #[inline(always)]
-    fn none(self) -> bool {
-        !self
-    }
+    fn none(self) -> bool { !self }
 }
 
 macro_rules! scalar_float_impl {
     ($ty:ident, $uty:ident) => {
         #[cfg(not(std))]
         impl Float for $ty {
+            type Bits = $uty;
+
             #[inline]
             fn is_nan(self) -> bool {
                 self != self
@@ -860,84 +810,61 @@
             fn is_finite(self) -> bool {
                 !(self.is_nan() || self.is_infinite())
             }
+
+            #[inline]
+            fn to_bits(self) -> Self::Bits {
+                unsafe { ::core::mem::transmute(self) }
+            }
+
+            #[inline]
+            fn from_bits(v: Self::Bits) -> Self {
+                // It turns out the safety issues with sNaN were overblown! Hooray!
+                unsafe { ::core::mem::transmute(v) }
+            }
         }
 
         impl FloatSIMDUtils for $ty {
             type Mask = bool;
-            type UInt = $uty;
-
             #[inline(always)]
-            fn all_lt(self, other: Self) -> bool {
-                self < other
-            }
-
+            fn all_lt(self, other: Self) -> bool { self < other }
             #[inline(always)]
-            fn all_le(self, other: Self) -> bool {
-                self <= other
-            }
-
+            fn all_le(self, other: Self) -> bool { self <= other }
             #[inline(always)]
-            fn all_finite(self) -> bool {
-                self.is_finite()
-            }
-
+            fn all_finite(self) -> bool { self.is_finite() }
             #[inline(always)]
-            fn finite_mask(self) -> Self::Mask {
-                self.is_finite()
-            }
-
+            fn finite_mask(self) -> Self::Mask { self.is_finite() }
             #[inline(always)]
-            fn gt_mask(self, other: Self) -> Self::Mask {
-                self > other
-            }
-
+            fn gt_mask(self, other: Self) -> Self::Mask { self > other }
             #[inline(always)]
-            fn ge_mask(self, other: Self) -> Self::Mask {
-                self >= other
-            }
-
+            fn ge_mask(self, other: Self) -> Self::Mask { self >= other }
             #[inline(always)]
             fn decrease_masked(self, mask: Self::Mask) -> Self {
                 debug_assert!(mask, "At least one lane must be set");
                 <$ty>::from_bits(self.to_bits() - 1)
             }
-
-            #[inline]
-            fn cast_from_int(i: Self::UInt) -> Self {
-                i as $ty
-            }
+            type UInt = $uty;
+            fn cast_from_int(i: Self::UInt) -> Self { i as $ty }
         }
 
         impl FloatAsSIMD for $ty {}
-    };
+    }
 }
 
 scalar_float_impl!(f32, u32);
 scalar_float_impl!(f64, u64);
 
 
-#[cfg(feature = "simd_support")]
+#[cfg(feature="simd_support")]
 macro_rules! simd_impl {
     ($ty:ident, $f_scalar:ident, $mty:ident, $uty:ident) => {
         impl FloatSIMDUtils for $ty {
             type Mask = $mty;
-            type UInt = $uty;
-
             #[inline(always)]
-            fn all_lt(self, other: Self) -> bool {
-                self.lt(other).all()
-            }
-
+            fn all_lt(self, other: Self) -> bool { self.lt(other).all() }
             #[inline(always)]
-            fn all_le(self, other: Self) -> bool {
-                self.le(other).all()
-            }
-
+            fn all_le(self, other: Self) -> bool { self.le(other).all() }
             #[inline(always)]
-            fn all_finite(self) -> bool {
-                self.finite_mask().all()
-            }
-
+            fn all_finite(self) -> bool { self.finite_mask().all() }
             #[inline(always)]
             fn finite_mask(self) -> Self::Mask {
                 // This can possibly be done faster by checking bit patterns
@@ -945,17 +872,10 @@
                 let pos_inf = $ty::splat(::core::$f_scalar::INFINITY);
                 self.gt(neg_inf) & self.lt(pos_inf)
             }
-
             #[inline(always)]
-            fn gt_mask(self, other: Self) -> Self::Mask {
-                self.gt(other)
-            }
-
+            fn gt_mask(self, other: Self) -> Self::Mask { self.gt(other) }
             #[inline(always)]
-            fn ge_mask(self, other: Self) -> Self::Mask {
-                self.ge(other)
-            }
-
+            fn ge_mask(self, other: Self) -> Self::Mask { self.ge(other) }
             #[inline(always)]
             fn decrease_masked(self, mask: Self::Mask) -> Self {
                 // Casting a mask into ints will produce all bits set for
@@ -967,13 +887,10 @@
                 debug_assert!(mask.any(), "At least one lane must be set");
                 <$ty>::from_bits(<$uty>::from_bits(self) + <$uty>::from_bits(mask))
             }
-
-            #[inline]
-            fn cast_from_int(i: Self::UInt) -> Self {
-                i.cast()
-            }
+            type UInt = $uty;
+            fn cast_from_int(i: Self::UInt) -> Self { i.cast() }
         }
-    };
+    }
 }
 
 #[cfg(feature="simd_support")] simd_impl! { f32x2, f32, m32x2, u32x2 }
@@ -997,7 +914,7 @@
 /// `Ag(z)` is an infinite series with coefficients that can be calculated
 /// ahead of time - we use just the first 6 terms, which is good enough
 /// for most purposes.
-#[cfg(feature = "std")]
+#[cfg(feature="std")]
 pub fn log_gamma(x: f64) -> f64 {
     // precalculated 6 coefficients for the first 6 terms of the series
     let coefficients: [f64; 6] = [
@@ -1042,21 +959,17 @@
 
 // the perf improvement (25-50%) is definitely worth the extra code
 // size from force-inlining.
-#[cfg(feature = "std")]
+#[cfg(feature="std")]
 #[inline(always)]
 pub fn ziggurat<R: Rng + ?Sized, P, Z>(
-    rng: &mut R,
-    symmetric: bool,
-    x_tab: ziggurat_tables::ZigTable,
-    f_tab: ziggurat_tables::ZigTable,
-    mut pdf: P,
-    mut zero_case: Z
-) -> f64
-where
-    P: FnMut(f64) -> f64,
-    Z: FnMut(&mut R, f64) -> f64,
-{
-    use crate::distributions::float::IntoFloat;
+            rng: &mut R,
+            symmetric: bool,
+            x_tab: ziggurat_tables::ZigTable,
+            f_tab: ziggurat_tables::ZigTable,
+            mut pdf: P,
+            mut zero_case: Z)
+            -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64 {
+    use distributions::float::IntoFloat;
     loop {
         // As an optimisation we re-implement the conversion to a f64.
         // From the remaining 12 most significant bits we use 8 to construct `i`.
@@ -1074,11 +987,12 @@
             (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)
-            (bits >> 12).into_float_with_exponent(0) - (1.0 - ::core::f64::EPSILON / 2.0)
+            (bits >> 12).into_float_with_exponent(0)
+            - (1.0 - ::core::f64::EPSILON / 2.0)
         };
         let x = u * x_tab[i];
 
-        let test_x = if symmetric { x.abs() } else { x };
+        let test_x = if symmetric { x.abs() } else {x};
 
         // algebraically equivalent to |u| < x_tab[i+1]/x_tab[i] (or u < x_tab[i+1]/x_tab[i])
         if test_x < x_tab[i + 1] {
diff --git a/src/rand/distributions/weibull.rs.html b/src/rand/distributions/weibull.rs.html
index 93526fc..f66f991 100644
--- a/src/rand/distributions/weibull.rs.html
+++ b/src/rand/distributions/weibull.rs.html
@@ -1,4 +1,4 @@
-weibull.rs.html -- source
 1
+weibull.rs.html -- source
 1
  2
  3
  4
@@ -65,6 +65,10 @@
 65
 66
 67
+68
+69
+70
+71
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -75,13 +79,20 @@
 // except according to those terms.
 
 //! The Weibull distribution.
-#![allow(deprecated)]
 
-use crate::distributions::{Distribution, OpenClosed01};
-use crate::Rng;
+use Rng;
+use distributions::{Distribution, OpenClosed01};
 
 /// Samples floating-point numbers according to the Weibull distribution
-#[deprecated(since = "0.7.0", note = "moved to rand_distr crate")]
+///
+/// # Example
+/// ```
+/// use rand::prelude::*;
+/// use rand::distributions::Weibull;
+///
+/// let val: f64 = SmallRng::from_entropy().sample(Weibull::new(1., 10.));
+/// println!("{}", val);
+/// ```
 #[derive(Clone, Copy, Debug)]
 pub struct Weibull {
     inv_shape: f64,
@@ -96,10 +107,7 @@
     /// `scale` and `shape` have to be non-zero and positive.
     pub fn new(scale: f64, shape: f64) -> Weibull {
         assert!((scale > 0.) & (shape > 0.));
-        Weibull {
-            inv_shape: 1. / shape,
-            scale,
-        }
+        Weibull { inv_shape: 1./shape, scale }
     }
 }
 
@@ -112,8 +120,8 @@
 
 #[cfg(test)]
 mod tests {
+    use distributions::Distribution;
     use super::Weibull;
-    use crate::distributions::Distribution;
 
     #[test]
     #[should_panic]
@@ -126,7 +134,7 @@
         let scale = 1.0;
         let shape = 2.0;
         let d = Weibull::new(scale, shape);
-        let mut rng = crate::test::rng(1);
+        let mut rng = ::test::rng(1);
         for _ in 0..1000 {
             let r = d.sample(&mut rng);
             assert!(r >= 0.);
diff --git a/src/rand/distributions/ziggurat_tables.rs.html b/src/rand/distributions/ziggurat_tables.rs.html
index 1f3ad0a..79e6984 100644
--- a/src/rand/distributions/ziggurat_tables.rs.html
+++ b/src/rand/distributions/ziggurat_tables.rs.html
@@ -1,4 +1,4 @@
-ziggurat_tables.rs.html -- source
  1
+ziggurat_tables.rs.html -- source
  1
   2
   3
   4
@@ -277,10 +277,6 @@
 277
 278
 279
-280
-281
-282
-283
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -296,7 +292,6 @@
 
 pub type ZigTable = &'static [f64; 257];
 pub const ZIG_NORM_R: f64 = 3.654152885361008796;
-#[rustfmt::skip]
 pub static ZIG_NORM_X: [f64; 257] =
     [3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074,
      3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434,
@@ -363,7 +358,6 @@
      0.487443966121754335, 0.463634336771763245, 0.437518402186662658, 0.408389134588000746,
      0.375121332850465727, 0.335737519180459465, 0.286174591747260509, 0.215241895913273806,
      0.000000000000000000];
-#[rustfmt::skip]
 pub static ZIG_NORM_F: [f64; 257] =
     [0.000477467764586655, 0.001260285930498598, 0.002609072746106363, 0.004037972593371872,
      0.005522403299264754, 0.007050875471392110, 0.008616582769422917, 0.010214971439731100,
@@ -431,7 +425,6 @@
      0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328,
      1.000000000000000000];
 pub const ZIG_EXP_R: f64 = 7.697117470131050077;
-#[rustfmt::skip]
 pub static ZIG_EXP_X: [f64; 257] =
     [8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696,
      6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488,
@@ -498,7 +491,6 @@
      0.253658363385912022, 0.233790483059674731, 0.212671510630966620, 0.189958689622431842,
      0.165127622564187282, 0.137304980940012589, 0.104838507565818778, 0.063852163815001570,
      0.000000000000000000];
-#[rustfmt::skip]
 pub static ZIG_EXP_F: [f64; 257] =
     [0.000167066692307963, 0.000454134353841497, 0.000967269282327174, 0.001536299780301573,
      0.002145967743718907, 0.002788798793574076, 0.003460264777836904, 0.004157295120833797,
diff --git a/src/rand/lib.rs.html b/src/rand/lib.rs.html
index f2511e0..ebc2bd3 100644
--- a/src/rand/lib.rs.html
+++ b/src/rand/lib.rs.html
@@ -1,4 +1,4 @@
-lib.rs.html -- source
  1
+lib.rs.html -- source
  1
   2
   3
   4
@@ -721,6 +721,113 @@
 721
 722
 723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013-2017 The Rust Project Developers.
@@ -764,72 +871,123 @@
 //! For the user guide and futher documentation, please read
 //! [The Rust Rand Book](https://rust-random.github.io/book).
 
-#![doc(
-    html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
-    html_favicon_url = "https://www.rust-lang.org/favicon.ico",
-    html_root_url = "https://rust-random.github.io/rand/"
-)]
+
+#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
+       html_favicon_url = "https://www.rust-lang.org/favicon.ico",
+       html_root_url = "https://rust-random.github.io/rand/")]
+
 #![deny(missing_docs)]
 #![deny(missing_debug_implementations)]
 #![doc(test(attr(allow(unused_variables), deny(warnings))))]
-#![cfg_attr(not(feature = "std"), no_std)]
-#![cfg_attr(all(feature = "simd_support", feature = "nightly"), feature(stdsimd))]
-#![allow(
-    clippy::excessive_precision,
-    clippy::unreadable_literal,
-    clippy::float_cmp
-)]
 
-#[cfg(all(feature = "alloc", not(feature = "std")))] extern crate alloc;
+#![cfg_attr(not(feature="std"), no_std)]
+#![cfg_attr(all(feature="alloc", not(feature="std")), feature(alloc))]
+#![cfg_attr(all(feature="simd_support", feature="nightly"), feature(stdsimd))]
 
+#[cfg(feature = "std")] extern crate core;
+#[cfg(all(feature = "alloc", not(feature="std")))] #[macro_use] extern crate alloc;
+
+#[cfg(feature="simd_support")] extern crate packed_simd;
+
+extern crate rand_jitter;
+#[cfg(feature = "rand_os")]
+extern crate rand_os;
+
+extern crate rand_core;
+extern crate rand_isaac;    // only for deprecations
+extern crate rand_chacha;    // only for deprecations
+extern crate rand_hc;
+extern crate rand_pcg;
+extern crate rand_xorshift;
+
+#[cfg(feature = "log")] #[macro_use] extern crate log;
 #[allow(unused)]
-macro_rules! trace { ($($x:tt)*) => (
-    #[cfg(feature = "log")] {
-        log::trace!($($x)*)
-    }
-) }
+#[cfg(not(feature = "log"))] macro_rules! trace { ($($x:tt)*) => () }
 #[allow(unused)]
-macro_rules! debug { ($($x:tt)*) => (
-    #[cfg(feature = "log")] {
-        log::debug!($($x)*)
-    }
-) }
+#[cfg(not(feature = "log"))] macro_rules! debug { ($($x:tt)*) => () }
 #[allow(unused)]
-macro_rules! info { ($($x:tt)*) => (
-    #[cfg(feature = "log")] {
-        log::info!($($x)*)
-    }
-) }
+#[cfg(not(feature = "log"))] macro_rules! info { ($($x:tt)*) => () }
 #[allow(unused)]
-macro_rules! warn { ($($x:tt)*) => (
-    #[cfg(feature = "log")] {
-        log::warn!($($x)*)
-    }
-) }
+#[cfg(not(feature = "log"))] macro_rules! warn { ($($x:tt)*) => () }
 #[allow(unused)]
-macro_rules! error { ($($x:tt)*) => (
-    #[cfg(feature = "log")] {
-        log::error!($($x)*)
-    }
-) }
+#[cfg(not(feature = "log"))] macro_rules! error { ($($x:tt)*) => () }
+
 
 // Re-exports from rand_core
-pub use rand_core::{CryptoRng, Error, RngCore, SeedableRng};
+pub use rand_core::{RngCore, CryptoRng, SeedableRng};
+pub use rand_core::{ErrorKind, Error};
 
 // Public exports
-#[cfg(feature = "std")] pub use crate::rngs::thread::thread_rng;
+#[cfg(feature="std")] pub use rngs::thread::thread_rng;
 
 // Public modules
 pub mod distributions;
 pub mod prelude;
+#[deprecated(since="0.6.0")]
+pub mod prng;
 pub mod rngs;
 pub mod seq;
 
+////////////////////////////////////////////////////////////////////////////////
+// Compatibility re-exports. Documentation is hidden; will be removed eventually.
+
+#[doc(hidden)] mod deprecated;
+
+#[allow(deprecated)]
+#[doc(hidden)] pub use deprecated::ReseedingRng;
+
+#[allow(deprecated)]
+#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::EntropyRng;
+
+#[allow(deprecated)]
+#[cfg(feature="rand_os")]
+#[doc(hidden)]
+pub use deprecated::OsRng;
+
+#[allow(deprecated)]
+#[doc(hidden)] pub use deprecated::{ChaChaRng, IsaacRng, Isaac64Rng, XorShiftRng};
+#[allow(deprecated)]
+#[doc(hidden)] pub use deprecated::StdRng;
+
+
+#[allow(deprecated)]
+#[doc(hidden)]
+pub mod jitter {
+    pub use deprecated::JitterRng;
+    pub use rngs::TimerError;
+}
+#[allow(deprecated)]
+#[cfg(feature="rand_os")]
+#[doc(hidden)]
+pub mod os {
+    pub use deprecated::OsRng;
+}
+#[allow(deprecated)]
+#[doc(hidden)]
+pub mod chacha {
+    pub use deprecated::ChaChaRng;
+}
+#[allow(deprecated)]
+#[doc(hidden)]
+pub mod isaac {
+    pub use deprecated::{IsaacRng, Isaac64Rng};
+}
+#[allow(deprecated)]
+#[cfg(feature="std")]
+#[doc(hidden)]
+pub mod read {
+    pub use deprecated::ReadRng;
+}
+
+#[allow(deprecated)]
+#[cfg(feature="std")] #[doc(hidden)] pub use deprecated::ThreadRng;
+
+////////////////////////////////////////////////////////////////////////////////
+
 
-use crate::distributions::uniform::{SampleBorrow, SampleUniform, UniformSampler};
-use crate::distributions::{Distribution, Standard};
-use core::num::Wrapping;
 use core::{mem, slice};
+use distributions::{Distribution, Standard};
+use distributions::uniform::{SampleUniform, UniformSampler, SampleBorrow};
 
 /// An automatically-implemented extension trait on [`RngCore`] providing high-level
 /// generic methods for sampling values and other convenience methods.
@@ -871,6 +1029,8 @@
 pub trait Rng: RngCore {
     /// Return a random value supporting the [`Standard`] distribution.
     ///
+    /// [`Standard`]: distributions::Standard
+    ///
     /// # Example
     ///
     /// ```
@@ -881,31 +1041,8 @@
     /// println!("{}", x);
     /// println!("{:?}", rng.gen::<(f64, bool)>());
     /// ```
-    ///
-    /// # Arrays and tuples
-    ///
-    /// The `rng.gen()` method is able to generate arrays (up to 32 elements)
-    /// and tuples (up to 12 elements), so long as all element types can be
-    /// generated.
-    ///
-    /// For arrays of integers, especially for those with small element types
-    /// (< 64 bit), it will likely be faster to instead use [`Rng::fill`].
-    ///
-    /// ```
-    /// use rand::{thread_rng, Rng};
-    ///
-    /// let mut rng = thread_rng();
-    /// let tuple: (u8, i32, char) = rng.gen(); // arbitrary tuple support
-    ///
-    /// let arr1: [f32; 32] = rng.gen();        // array construction
-    /// let mut arr2 = [0u8; 128];
-    /// rng.fill(&mut arr2);                    // array fill
-    /// ```
-    ///
-    /// [`Standard`]: distributions::Standard
     #[inline]
-    fn gen<T>(&mut self) -> T
-    where Standard: Distribution<T> {
+    fn gen<T>(&mut self) -> T where Standard: Distribution<T> {
         Standard.sample(self)
     }
 
@@ -934,10 +1071,8 @@
     ///
     /// [`Uniform`]: distributions::uniform::Uniform
     fn gen_range<T: SampleUniform, B1, B2>(&mut self, low: B1, high: B2) -> T
-    where
-        B1: SampleBorrow<T> + Sized,
-        B2: SampleBorrow<T> + Sized,
-    {
+        where B1: SampleBorrow<T> + Sized,
+              B2: SampleBorrow<T> + Sized {
         T::Sampler::sample_single(low, high, self)
     }
 
@@ -961,41 +1096,33 @@
 
     /// Create an iterator that generates values using the given distribution.
     ///
-    /// Note that this function takes its arguments by value. This works since
-    /// `(&mut R): Rng where R: Rng` and
-    /// `(&D): Distribution where D: Distribution`,
-    /// however borrowing is not automatic hence `rng.sample_iter(...)` may
-    /// need to be replaced with `(&mut rng).sample_iter(...)`.
-    ///
     /// # Example
     ///
     /// ```
     /// use rand::{thread_rng, Rng};
     /// use rand::distributions::{Alphanumeric, Uniform, Standard};
     ///
-    /// let rng = thread_rng();
+    /// let mut rng = thread_rng();
     ///
     /// // Vec of 16 x f32:
-    /// let v: Vec<f32> = rng.sample_iter(Standard).take(16).collect();
+    /// let v: Vec<f32> = thread_rng().sample_iter(&Standard).take(16).collect();
     ///
     /// // String:
-    /// let s: String = rng.sample_iter(Alphanumeric).take(7).collect();
+    /// let s: String = rng.sample_iter(&Alphanumeric).take(7).collect();
     ///
     /// // Combined values
-    /// println!("{:?}", rng.sample_iter(Standard).take(5)
+    /// println!("{:?}", thread_rng().sample_iter(&Standard).take(5)
     ///                              .collect::<Vec<(f64, bool)>>());
     ///
     /// // Dice-rolling:
     /// let die_range = Uniform::new_inclusive(1, 6);
-    /// let mut roll_die = rng.sample_iter(die_range);
+    /// let mut roll_die = rng.sample_iter(&die_range);
     /// while roll_die.next().unwrap() != 6 {
     ///     println!("Not a 6; rolling again!");
     /// }
     /// ```
-    fn sample_iter<T, D>(self, distr: D) -> distributions::DistIter<D, Self, T>
-    where
-        D: Distribution<T>,
-        Self: Sized,
+    fn sample_iter<'a, T, D: Distribution<T>>(&'a mut self, distr: &'a D)
+        -> distributions::DistIter<'a, D, Self, T> where Self: Sized
     {
         distr.sample_iter(self)
     }
@@ -1034,8 +1161,10 @@
     /// On big-endian platforms this performs byte-swapping to ensure
     /// portability of results from reproducible generators.
     ///
-    /// This is identical to [`fill`] except that it uses [`try_fill_bytes`]
-    /// internally and forwards RNG errors.
+    /// This uses [`try_fill_bytes`] internally and forwards all RNG errors. In
+    /// some cases errors may be resolvable; see [`ErrorKind`] and
+    /// documentation for the RNG in use. If you do not plan to handle these
+    /// errors you may prefer to use [`fill`].
     ///
     /// # Example
     ///
@@ -1081,7 +1210,7 @@
     /// [`Bernoulli`]: distributions::bernoulli::Bernoulli
     #[inline]
     fn gen_bool(&mut self, p: f64) -> bool {
-        let d = distributions::Bernoulli::new(p).unwrap();
+        let d = distributions::Bernoulli::new(p);
         self.sample(d)
     }
 
@@ -1110,9 +1239,36 @@
     /// [`Bernoulli`]: distributions::bernoulli::Bernoulli
     #[inline]
     fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool {
-        let d = distributions::Bernoulli::from_ratio(numerator, denominator).unwrap();
+        let d = distributions::Bernoulli::from_ratio(numerator, denominator);
         self.sample(d)
     }
+
+    /// Return a random element from `values`.
+    ///
+    /// Deprecated: use [`seq::SliceRandom::choose`] instead.
+    #[deprecated(since="0.6.0", note="use SliceRandom::choose instead")]
+    fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
+        use seq::SliceRandom;
+        values.choose(self)
+    }
+
+    /// Return a mutable pointer to a random element from `values`.
+    ///
+    /// Deprecated: use [`seq::SliceRandom::choose_mut`] instead.
+    #[deprecated(since="0.6.0", note="use SliceRandom::choose_mut instead")]
+    fn choose_mut<'a, T>(&mut self, values: &'a mut [T]) -> Option<&'a mut T> {
+        use seq::SliceRandom;
+        values.choose_mut(self)
+    }
+
+    /// Shuffle a mutable slice in place.
+    ///
+    /// Deprecated: use [`seq::SliceRandom::shuffle`] instead.
+    #[deprecated(since="0.6.0", note="use SliceRandom::shuffle instead")]
+    fn shuffle<T>(&mut self, values: &mut [T]) {
+        use seq::SliceRandom;
+        values.shuffle(self)
+    }
 }
 
 impl<R: RngCore + ?Sized> Rng for R {}
@@ -1137,7 +1293,6 @@
 }
 
 macro_rules! impl_as_byte_slice {
-    () => {};
     ($t:ty) => {
         impl AsByteSliceMut for [$t] {
             fn as_byte_slice_mut(&mut self) -> &mut [u8] {
@@ -1148,7 +1303,8 @@
                     }
                 } else {
                     unsafe {
-                        slice::from_raw_parts_mut(self.as_mut_ptr()
+                        slice::from_raw_parts_mut(&mut self[0]
+                            as *mut $t
                             as *mut u8,
                             self.len() * mem::size_of::<$t>()
                         )
@@ -1162,49 +1318,26 @@
                 }
             }
         }
-
-        impl AsByteSliceMut for [Wrapping<$t>] {
-            fn as_byte_slice_mut(&mut self) -> &mut [u8] {
-                if self.len() == 0 {
-                    unsafe {
-                        // must not use null pointer
-                        slice::from_raw_parts_mut(0x1 as *mut u8, 0)
-                    }
-                } else {
-                    unsafe {
-                        slice::from_raw_parts_mut(self.as_mut_ptr()
-                            as *mut u8,
-                            self.len() * mem::size_of::<$t>()
-                        )
-                    }
-                }
-            }
-
-            fn to_le(&mut self) {
-                for x in self {
-                    *x = Wrapping(x.0.to_le());
-                }
-            }
-        }
-    };
-    ($t:ty, $($tt:ty,)*) => {
-        impl_as_byte_slice!($t);
-        // TODO: this could replace above impl once Rust #32463 is fixed
-        // impl_as_byte_slice!(Wrapping<$t>);
-        impl_as_byte_slice!($($tt,)*);
     }
 }
 
-impl_as_byte_slice!(u16, u32, u64, usize,);
-#[cfg(not(target_os = "emscripten"))]
-impl_as_byte_slice!(u128);
-impl_as_byte_slice!(i8, i16, i32, i64, isize,);
-#[cfg(not(target_os = "emscripten"))]
-impl_as_byte_slice!(i128);
+impl_as_byte_slice!(u16);
+impl_as_byte_slice!(u32);
+impl_as_byte_slice!(u64);
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(u128);
+impl_as_byte_slice!(usize);
+impl_as_byte_slice!(i8);
+impl_as_byte_slice!(i16);
+impl_as_byte_slice!(i32);
+impl_as_byte_slice!(i64);
+#[cfg(all(rustc_1_26, not(target_os = "emscripten")))] impl_as_byte_slice!(i128);
+impl_as_byte_slice!(isize);
 
 macro_rules! impl_as_byte_slice_arrays {
     ($n:expr,) => {};
-    ($n:expr, $N:ident) => {
+    ($n:expr, $N:ident, $($NN:ident,)*) => {
+        impl_as_byte_slice_arrays!($n - 1, $($NN,)*);
+
         impl<T> AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut {
             fn as_byte_slice_mut(&mut self) -> &mut [u8] {
                 self[..].as_byte_slice_mut()
@@ -1215,20 +1348,94 @@
             }
         }
     };
-    ($n:expr, $N:ident, $($NN:ident,)*) => {
-        impl_as_byte_slice_arrays!($n, $N);
-        impl_as_byte_slice_arrays!($n - 1, $($NN,)*);
-    };
     (!div $n:expr,) => {};
     (!div $n:expr, $N:ident, $($NN:ident,)*) => {
-        impl_as_byte_slice_arrays!($n, $N);
         impl_as_byte_slice_arrays!(!div $n / 2, $($NN,)*);
+
+        impl<T> AsByteSliceMut for [T; $n] where [T]: AsByteSliceMut {
+            fn as_byte_slice_mut(&mut self) -> &mut [u8] {
+                self[..].as_byte_slice_mut()
+            }
+
+            fn to_le(&mut self) {
+                self[..].to_le()
+            }
+        }
     };
 }
-#[rustfmt::skip]
 impl_as_byte_slice_arrays!(32, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,);
 impl_as_byte_slice_arrays!(!div 4096, N,N,N,N,N,N,N,);
 
+
+/// A convenience extension to [`SeedableRng`] allowing construction from fresh
+/// entropy. This trait is automatically implemented for any PRNG implementing
+/// [`SeedableRng`] and is not intended to be implemented by users.
+///
+/// This is equivalent to using `SeedableRng::from_rng(EntropyRng::new())` then
+/// unwrapping the result.
+///
+/// Since this is convenient and secure, it is the recommended way to create
+/// PRNGs, though two alternatives may be considered:
+///
+/// *   Deterministic creation using [`SeedableRng::from_seed`] with a fixed seed
+/// *   Seeding from `thread_rng`: `SeedableRng::from_rng(thread_rng())?`;
+///     this will usually be faster and should also be secure, but requires
+///     trusting one extra component.
+///
+/// ## Example
+///
+/// ```
+/// use rand::{Rng, FromEntropy};
+/// use rand::rngs::StdRng;
+///
+/// let mut rng = StdRng::from_entropy();
+/// println!("Random die roll: {}", rng.gen_range(1, 7));
+/// ```
+///
+/// [`EntropyRng`]: rngs::EntropyRng
+#[cfg(feature="std")]
+pub trait FromEntropy: SeedableRng {
+    /// Creates a new instance, automatically seeded with fresh entropy.
+    ///
+    /// Normally this will use `OsRng`, but if that fails `JitterRng` will be
+    /// used instead. Both should be suitable for cryptography. It is possible
+    /// that both entropy sources will fail though unlikely; failures would
+    /// almost certainly be platform limitations or build issues, i.e. most
+    /// applications targetting PC/mobile platforms should not need to worry
+    /// about this failing.
+    ///
+    /// # Panics
+    ///
+    /// If all entropy sources fail this will panic. If you need to handle
+    /// errors, use the following code, equivalent aside from error handling:
+    ///
+    /// ```
+    /// # use rand::Error;
+    /// use rand::prelude::*;
+    /// use rand::rngs::EntropyRng;
+    ///
+    /// # fn try_inner() -> Result<(), Error> {
+    /// // This uses StdRng, but is valid for any R: SeedableRng
+    /// let mut rng = StdRng::from_rng(EntropyRng::new())?;
+    ///
+    /// println!("random number: {}", rng.gen_range(1, 10));
+    /// # Ok(())
+    /// # }
+    ///
+    /// # try_inner().unwrap()
+    /// ```
+    fn from_entropy() -> Self;
+}
+
+#[cfg(feature="std")]
+impl<R: SeedableRng> FromEntropy for R {
+    fn from_entropy() -> R {
+        R::from_rng(rngs::EntropyRng::new()).unwrap_or_else(|err|
+            panic!("FromEntropy::from_entropy() failed: {}", err))
+    }
+}
+
+
 /// Generates a random value using the thread-local random number generator.
 ///
 /// This is simply a shortcut for `thread_rng().gen()`. See [`thread_rng`] for
@@ -1271,25 +1478,38 @@
 /// ```
 ///
 /// [`Standard`]: distributions::Standard
-#[cfg(feature = "std")]
+#[cfg(feature="std")]
 #[inline]
-pub fn random<T>() -> T
-where Standard: Distribution<T> {
+pub fn random<T>() -> T where Standard: Distribution<T> {
     thread_rng().gen()
 }
 
 #[cfg(test)]
 mod test {
+    use rngs::mock::StepRng;
+    use rngs::StdRng;
     use super::*;
-    use crate::rngs::mock::StepRng;
-    #[cfg(all(not(feature = "std"), feature = "alloc"))] use alloc::boxed::Box;
+    #[cfg(all(not(feature="std"), feature="alloc"))] use alloc::boxed::Box;
 
-    /// Construct a deterministic RNG with the given seed
-    pub fn rng(seed: u64) -> impl RngCore {
-        // For tests, we want a statistically good, fast, reproducible RNG.
-        // PCG32 will do fine, and will be easy to embed if we ever need to.
-        const INC: u64 = 11634580027462260723;
-        rand_pcg::Pcg32::new(seed, INC)
+    pub struct TestRng<R> { inner: R }
+
+    impl<R: RngCore> RngCore for TestRng<R> {
+        fn next_u32(&mut self) -> u32 {
+            self.inner.next_u32()
+        }
+        fn next_u64(&mut self) -> u64 {
+            self.inner.next_u64()
+        }
+        fn fill_bytes(&mut self, dest: &mut [u8]) {
+            self.inner.fill_bytes(dest)
+        }
+        fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+            self.inner.try_fill_bytes(dest)
+        }
+    }
+
+    pub fn rng(seed: u64) -> TestRng<StdRng> {
+        TestRng { inner: StdRng::seed_from_u64(seed) }
     }
 
     #[test]
@@ -1297,7 +1517,8 @@
         let mut r = StepRng::new(0x11_22_33_44_55_66_77_88, 0);
 
         // check every remainder mod 8, both in small and big vectors.
-        let lengths = [0, 1, 2, 3, 4, 5, 6, 7, 80, 81, 82, 83, 84, 85, 86, 87];
+        let lengths = [0, 1, 2, 3, 4, 5, 6, 7,
+                       80, 81, 82, 83, 84, 85, 86, 87];
         for &n in lengths.iter() {
             let mut buffer = [0u8; 87];
             let v = &mut buffer[0..n];
@@ -1314,7 +1535,7 @@
 
     #[test]
     fn test_fill() {
-        let x = 9041086907909331047; // a random u64
+        let x = 9041086907909331047;    // a random u64
         let mut rng = StepRng::new(x, 0);
 
         // Convert to byte sequence and back to u64; byte-swap twice if BE.
@@ -1328,12 +1549,6 @@
         rng.fill(&mut array[..]);
         assert_eq!(array, [x as u32, (x >> 32) as u32]);
         assert_eq!(rng.next_u32(), x as u32);
-
-        // Check equivalence using wrapped arrays
-        let mut warray = [Wrapping(0u32); 2];
-        rng.fill(&mut warray[..]);
-        assert_eq!(array[0], warray[0].0);
-        assert_eq!(array[1], warray[1].0);
     }
 
     #[test]
@@ -1390,9 +1605,9 @@
 
     #[test]
     fn test_rng_trait_object() {
-        use crate::distributions::{Distribution, Standard};
+        use distributions::{Distribution, Standard};
         let mut rng = rng(109);
-        let mut r = &mut rng as &mut dyn RngCore;
+        let mut r = &mut rng as &mut RngCore;
         r.next_u32();
         r.gen::<i32>();
         assert_eq!(r.gen_range(0, 1), 0);
@@ -1400,11 +1615,11 @@
     }
 
     #[test]
-    #[cfg(feature = "alloc")]
+    #[cfg(feature="alloc")]
     fn test_rng_boxed_trait() {
-        use crate::distributions::{Distribution, Standard};
+        use distributions::{Distribution, Standard};
         let rng = rng(110);
-        let mut r = Box::new(rng) as Box<dyn RngCore>;
+        let mut r = Box::new(rng) as Box<RngCore>;
         r.next_u32();
         r.gen::<i32>();
         assert_eq!(r.gen_range(0, 1), 0);
@@ -1412,22 +1627,21 @@
     }
 
     #[test]
-    #[cfg(feature = "std")]
+    #[cfg(feature="std")]
     fn test_random() {
         // not sure how to test this aside from just getting some values
-        let _n: usize = random();
-        let _f: f32 = random();
-        let _o: Option<Option<i8>> = random();
-        let _many: (
-            (),
-            (usize, isize, Option<(u32, (bool,))>),
-            (u8, i8, u16, i16, u32, i32, u64, i64),
-            (f32, (f64, (f64,))),
-        ) = random();
+        let _n : usize = random();
+        let _f : f32 = random();
+        let _o : Option<Option<i8>> = random();
+        let _many : ((),
+                     (usize,
+                      isize,
+                      Option<(u32, (bool,))>),
+                     (u8, i8, u16, i16, u32, i32, u64, i64),
+                     (f32, (f64, (f64,)))) = random();
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_gen_ratio_average() {
         const NUM: u32 = 3;
         const DENOM: u32 = 10;
@@ -1441,7 +1655,7 @@
             }
         }
         // Have Binomial(N, NUM/DENOM) distribution
-        let expected = (NUM * N) / DENOM; // exact integer
+        let expected = (NUM * N) / DENOM;   // exact integer
         assert!(((sum - expected) as i32).abs() < 500);
     }
 }
diff --git a/src/rand/prelude.rs.html b/src/rand/prelude.rs.html
index 1cb7534..f9ad5cd 100644
--- a/src/rand/prelude.rs.html
+++ b/src/rand/prelude.rs.html
@@ -1,4 +1,4 @@
-prelude.rs.html -- source
 1
+prelude.rs.html -- source
 1
  2
  3
  4
@@ -25,12 +25,6 @@
 25
 26
 27
-28
-29
-30
-31
-32
-33
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -48,22 +42,16 @@
 //!
 //! ```
 //! use rand::prelude::*;
-//! # let mut r = StdRng::from_rng(thread_rng()).unwrap();
+//! # let _ = StdRng::from_entropy();
+//! # let mut r = SmallRng::from_rng(thread_rng()).unwrap();
 //! # let _: f32 = r.gen();
 //! ```
 
-#[doc(no_inline)] pub use crate::distributions::Distribution;
-#[cfg(feature = "small_rng")]
-#[doc(no_inline)]
-pub use crate::rngs::SmallRng;
-#[doc(no_inline)] pub use crate::rngs::StdRng;
-#[doc(no_inline)]
-#[cfg(feature = "std")]
-pub use crate::rngs::ThreadRng;
-#[doc(no_inline)] pub use crate::seq::{IteratorRandom, SliceRandom};
-#[doc(no_inline)]
-#[cfg(feature = "std")]
-pub use crate::{random, thread_rng};
-#[doc(no_inline)] pub use crate::{CryptoRng, Rng, RngCore, SeedableRng};
+#[doc(no_inline)] pub use distributions::Distribution;
+#[doc(no_inline)] pub use rngs::{SmallRng, StdRng};
+#[doc(no_inline)] #[cfg(feature="std")] pub use rngs::ThreadRng;
+#[doc(no_inline)] pub use {Rng, RngCore, CryptoRng, SeedableRng};
+#[doc(no_inline)] #[cfg(feature="std")] pub use {FromEntropy, random, thread_rng};
+#[doc(no_inline)] pub use seq::{SliceRandom, IteratorRandom};
 
\ No newline at end of file diff --git a/src/rand/rngs/adapter/mod.rs.html b/src/rand/rngs/adapter/mod.rs.html index a7e8506..9d43149 100644 --- a/src/rand/rngs/adapter/mod.rs.html +++ b/src/rand/rngs/adapter/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs.html -- source
 1
+mod.rs.html -- source
 1
  2
  3
  4
@@ -24,10 +24,10 @@
 
 //! Wrappers / adapters forming RNGs
 
-#[cfg(feature = "std")] mod read;
+#[cfg(feature="std")] #[doc(hidden)] pub mod read;
 mod reseeding;
 
-#[cfg(feature = "std")] pub use self::read::{ReadError, ReadRng};
+#[cfg(feature="std")] pub use self::read::ReadRng;
 pub use self::reseeding::ReseedingRng;
 
\ No newline at end of file diff --git a/src/rand/rngs/adapter/read.rs.html b/src/rand/rngs/adapter/read.rs.html index 1d6eefa..4e38151 100644 --- a/src/rand/rngs/adapter/read.rs.html +++ b/src/rand/rngs/adapter/read.rs.html @@ -1,4 +1,4 @@ -read.rs.html -- source
  1
+read.rs.html -- source
  1
   2
   3
   4
@@ -134,25 +134,6 @@
 134
 135
 136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -165,10 +146,9 @@
 
 //! A wrapper around any Read to treat it as an RNG.
 
-use std::fmt;
 use std::io::Read;
 
-use rand_core::{impls, Error, RngCore};
+use rand_core::{RngCore, Error, ErrorKind, impls};
 
 
 /// An RNG that reads random bytes straight from any type supporting
@@ -197,17 +177,19 @@
 /// println!("{:x}", rng.gen::<u32>());
 /// ```
 ///
-/// [`OsRng`]: crate::rngs::OsRng
+/// [`OsRng`]: rand_os::OsRng
 /// [`try_fill_bytes`]: RngCore::try_fill_bytes
 #[derive(Debug)]
 pub struct ReadRng<R> {
-    reader: R,
+    reader: R
 }
 
 impl<R: Read> ReadRng<R> {
     /// Create a new `ReadRng` from a `Read`.
     pub fn new(r: R) -> ReadRng<R> {
-        ReadRng { reader: r }
+        ReadRng {
+            reader: r
+        }
     }
 }
 
@@ -221,51 +203,33 @@
     }
 
     fn fill_bytes(&mut self, dest: &mut [u8]) {
-        self.try_fill_bytes(dest).unwrap_or_else(|err| {
-            panic!(
-                "reading random bytes from Read implementation failed; error: {}",
-                err
-            )
-        });
+        self.try_fill_bytes(dest).unwrap_or_else(|err|
+                panic!("reading random bytes from Read implementation failed; error: {}", err));
     }
 
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        if dest.is_empty() {
-            return Ok(());
-        }
+        if dest.len() == 0 { return Ok(()); }
         // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.
-        self.reader
-            .read_exact(dest)
-            .map_err(|e| Error::new(ReadError(e)))
+        self.reader.read_exact(dest).map_err(|err| {
+            match err.kind() {
+                ::std::io::ErrorKind::UnexpectedEof => Error::with_cause(
+                    ErrorKind::Unavailable,
+                    "not enough bytes available, reached end of source", err),
+                _ => Error::with_cause(ErrorKind::Unavailable,
+                    "error reading from Read source", err)
+            }
+        })
     }
 }
 
-/// `ReadRng` error type
-#[derive(Debug)]
-pub struct ReadError(std::io::Error);
-
-impl fmt::Display for ReadError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "ReadError: {}", self.0)
-    }
-}
-
-impl std::error::Error for ReadError {
-    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
-        Some(&self.0)
-    }
-}
-
-
 #[cfg(test)]
 mod test {
     use super::ReadRng;
-    use crate::RngCore;
+    use {RngCore, ErrorKind};
 
     #[test]
     fn test_reader_rng_u64() {
         // transmute from the target to avoid endianness concerns.
-        #[rustfmt::skip]
         let v = vec![0u8, 0, 0, 0, 0, 0, 0, 1,
                      0  , 0, 0, 0, 0, 0, 0, 2,
                      0,   0, 0, 0, 0, 0, 0, 3];
@@ -304,9 +268,7 @@
 
         let mut rng = ReadRng::new(&v[..]);
 
-        let result = rng.try_fill_bytes(&mut w);
-        assert!(result.is_err());
-        println!("Error: {}", result.unwrap_err());
+        assert!(rng.try_fill_bytes(&mut w).err().unwrap().kind == ErrorKind::Unavailable);
     }
 }
 
diff --git a/src/rand/rngs/adapter/reseeding.rs.html b/src/rand/rngs/adapter/reseeding.rs.html index 692fd95..18cb1c0 100644 --- a/src/rand/rngs/adapter/reseeding.rs.html +++ b/src/rand/rngs/adapter/reseeding.rs.html @@ -1,4 +1,4 @@ -reseeding.rs.html -- source
  1
+reseeding.rs.html -- source
  1
   2
   3
   4
@@ -367,6 +367,7 @@
 367
 368
 369
+370
 
 // Copyright 2018 Developers of the Rand project.
 // Copyright 2013 The Rust Project Developers.
@@ -382,8 +383,8 @@
 
 use core::mem::size_of;
 
-use rand_core::block::{BlockRng, BlockRngCore};
-use rand_core::{CryptoRng, Error, RngCore, SeedableRng};
+use rand_core::{RngCore, CryptoRng, SeedableRng, Error, ErrorKind};
+use rand_core::block::{BlockRngCore, BlockRng};
 
 /// A wrapper around any PRNG that implements [`BlockRngCore`], that adds the
 /// ability to reseed it.
@@ -394,7 +395,7 @@
 /// - After `clone()`, the clone will be reseeded on first use.
 /// - After a process is forked, the RNG in the child process is reseeded within
 ///   the next few generated values, depending on the block size of the
-///   underlying PRNG. For ChaCha and Hc128 this is a maximum of
+///   underlying PRNG. For [`ChaChaCore`] and [`Hc128Core`] this is a maximum of
 ///   15 `u32` values before reseeding.
 /// - After the PRNG has generated a configurable number of random bytes.
 ///
@@ -427,34 +428,41 @@
 /// # Example
 ///
 /// ```
+/// # extern crate rand;
+/// # extern crate rand_chacha;
+/// # fn main() {
 /// use rand::prelude::*;
-/// use rand_chacha::ChaCha20Core; // Internal part of ChaChaRng that
+/// use rand_chacha::ChaChaCore; // Internal part of ChaChaRng that
 ///                              // implements BlockRngCore
 /// use rand::rngs::OsRng;
 /// use rand::rngs::adapter::ReseedingRng;
 ///
-/// let prng = ChaCha20Core::from_entropy();
-/// let mut reseeding_rng = ReseedingRng::new(prng, 0, OsRng);
+/// let prng = ChaChaCore::from_entropy();
+// FIXME: it is better to use EntropyRng as reseeder, but that doesn't implement
+// clone yet.
+/// let reseeder = OsRng::new().unwrap();
+/// let mut reseeding_rng = ReseedingRng::new(prng, 0, reseeder);
 ///
 /// println!("{}", reseeding_rng.gen::<u64>());
 ///
 /// let mut cloned_rng = reseeding_rng.clone();
 /// assert!(reseeding_rng.gen::<u64>() != cloned_rng.gen::<u64>());
+/// # }
 /// ```
 ///
+/// [`ChaChaCore`]: rand_chacha::ChaChaCore
+/// [`Hc128Core`]: rand_hc::Hc128Core
 /// [`BlockRngCore`]: rand_core::block::BlockRngCore
 /// [`ReseedingRng::new`]: ReseedingRng::new
 /// [`reseed()`]: ReseedingRng::reseed
 #[derive(Debug)]
 pub struct ReseedingRng<R, Rsdr>(BlockRng<ReseedingCore<R, Rsdr>>)
-where
-    R: BlockRngCore + SeedableRng,
-    Rsdr: RngCore;
+where R: BlockRngCore + SeedableRng,
+      Rsdr: RngCore;
 
 impl<R, Rsdr> ReseedingRng<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng,
-    Rsdr: RngCore,
+where R: BlockRngCore + SeedableRng,
+      Rsdr: RngCore
 {
     /// Create a new `ReseedingRng` from an existing PRNG, combined with a RNG
     /// to use as reseeder.
@@ -475,9 +483,8 @@
 // TODO: this should be implemented for any type where the inner type
 // implements RngCore, but we can't specify that because ReseedingCore is private
 impl<R, Rsdr: RngCore> RngCore for ReseedingRng<R, Rsdr>
-where
-    R: BlockRngCore<Item = u32> + SeedableRng,
-    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>,
+where R: BlockRngCore<Item = u32> + SeedableRng,
+    <R as BlockRngCore>::Results: AsRef<[u32]> + AsMut<[u32]>
 {
     #[inline(always)]
     fn next_u32(&mut self) -> u32 {
@@ -499,9 +506,8 @@
 }
 
 impl<R, Rsdr> Clone for ReseedingRng<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng + Clone,
-    Rsdr: RngCore + Clone,
+where R: BlockRngCore + SeedableRng + Clone,
+      Rsdr: RngCore + Clone
 {
     fn clone(&self) -> ReseedingRng<R, Rsdr> {
         // Recreating `BlockRng` seems easier than cloning it and resetting
@@ -511,11 +517,8 @@
 }
 
 impl<R, Rsdr> CryptoRng for ReseedingRng<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng + CryptoRng,
-    Rsdr: RngCore + CryptoRng,
-{
-}
+where R: BlockRngCore + SeedableRng + CryptoRng,
+      Rsdr: RngCore + CryptoRng {}
 
 #[derive(Debug)]
 struct ReseedingCore<R, Rsdr> {
@@ -527,16 +530,16 @@
 }
 
 impl<R, Rsdr> BlockRngCore for ReseedingCore<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng,
-    Rsdr: RngCore,
+where R: BlockRngCore + SeedableRng,
+      Rsdr: RngCore
 {
     type Item = <R as BlockRngCore>::Item;
     type Results = <R as BlockRngCore>::Results;
 
     fn generate(&mut self, results: &mut Self::Results) {
         let global_fork_counter = fork::get_fork_counter();
-        if self.bytes_until_reseed <= 0 || self.is_forked(global_fork_counter) {
+        if self.bytes_until_reseed <= 0 ||
+           self.is_forked(global_fork_counter) {
             // We get better performance by not calling only `reseed` here
             // and continuing with the rest of the function, but by directly
             // returning from a non-inlined function.
@@ -549,9 +552,8 @@
 }
 
 impl<R, Rsdr> ReseedingCore<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng,
-    Rsdr: RngCore,
+where R: BlockRngCore + SeedableRng,
+      Rsdr: RngCore
 {
     /// Create a new `ReseedingCore`.
     fn new(rng: R, threshold: u64, reseeder: Rsdr) -> Self {
@@ -562,13 +564,10 @@
         // current hardware, we just clamp to that value.
         // Also we set a threshold of 0, which indicates no limit, to that
         // value.
-        let threshold = if threshold == 0 {
-            MAX
-        } else if threshold <= MAX as u64 {
-            threshold as i64
-        } else {
-            MAX
-        };
+        let threshold =
+            if threshold == 0 { MAX }
+            else if threshold <= MAX as u64 { threshold as i64 }
+            else { MAX };
 
         ReseedingCore {
             inner: rng,
@@ -602,33 +601,41 @@
     }
 
     #[inline(never)]
-    fn reseed_and_generate(
-        &mut self, results: &mut <Self as BlockRngCore>::Results, global_fork_counter: usize,
-    ) {
-        #![allow(clippy::if_same_then_else)] // false positive
+    fn reseed_and_generate(&mut self,
+                           results: &mut <Self as BlockRngCore>::Results,
+                           global_fork_counter: usize)
+    {
         if self.is_forked(global_fork_counter) {
             info!("Fork detected, reseeding RNG");
         } else {
             trace!("Reseeding RNG (periodic reseed)");
         }
 
-        let num_bytes = results.as_ref().len() * size_of::<<R as BlockRngCore>::Item>();
+        let num_bytes =
+            results.as_ref().len() * size_of::<<R as BlockRngCore>::Item>();
 
-        if let Err(e) = self.reseed() {
-            warn!("Reseeding RNG failed: {}", e);
-            let _ = e;
-        }
-        self.fork_counter = global_fork_counter;
+        let threshold = if let Err(e) = self.reseed() {
+            let delay = match e.kind {
+                ErrorKind::Transient => num_bytes as i64,
+                kind @ _ if kind.should_retry() => self.threshold >> 8,
+                _ => self.threshold,
+            };
+            warn!("Reseeding RNG delayed reseeding by {} bytes due to \
+                   error from source: {}", delay, e);
+            delay
+        } else {
+            self.fork_counter = global_fork_counter;
+            self.threshold
+        };
 
-        self.bytes_until_reseed = self.threshold - num_bytes as i64;
+        self.bytes_until_reseed = threshold - num_bytes as i64;
         self.inner.generate(results);
     }
 }
 
 impl<R, Rsdr> Clone for ReseedingCore<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng + Clone,
-    Rsdr: RngCore + Clone,
+where R: BlockRngCore + SeedableRng + Clone,
+      Rsdr: RngCore + Clone
 {
     fn clone(&self) -> ReseedingCore<R, Rsdr> {
         ReseedingCore {
@@ -642,17 +649,16 @@
 }
 
 impl<R, Rsdr> CryptoRng for ReseedingCore<R, Rsdr>
-where
-    R: BlockRngCore + SeedableRng + CryptoRng,
-    Rsdr: RngCore + CryptoRng,
-{
-}
+where R: BlockRngCore + SeedableRng + CryptoRng,
+      Rsdr: RngCore + CryptoRng {}
 
 
-#[cfg(all(unix, feature = "std", not(target_os = "emscripten")))]
+#[cfg(all(feature="std", unix, not(target_os="emscripten")))]
 mod fork {
-    use core::sync::atomic::{AtomicUsize, Ordering};
-    use std::sync::Once;
+    extern crate libc;
+
+    use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+    use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
 
     // Fork protection
     //
@@ -666,58 +672,56 @@
     // don't update `fork_counter`, so a reseed is attempted as soon as
     // possible.
 
-    static RESEEDING_RNG_FORK_COUNTER: AtomicUsize = AtomicUsize::new(0);
+    static RESEEDING_RNG_FORK_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
 
     pub fn get_fork_counter() -> usize {
         RESEEDING_RNG_FORK_COUNTER.load(Ordering::Relaxed)
     }
 
-    extern "C" fn fork_handler() {
+    static FORK_HANDLER_REGISTERED: AtomicBool = ATOMIC_BOOL_INIT;
+
+    extern fn fork_handler() {
         // Note: fetch_add is defined to wrap on overflow
         // (which is what we want).
         RESEEDING_RNG_FORK_COUNTER.fetch_add(1, Ordering::Relaxed);
     }
 
     pub fn register_fork_handler() {
-        static REGISTER: Once = Once::new();
-        REGISTER.call_once(|| unsafe {
-            libc::pthread_atfork(None, None, Some(fork_handler));
-        });
+        if FORK_HANDLER_REGISTERED.load(Ordering::Relaxed) == false {
+            unsafe { libc::pthread_atfork(None, None, Some(fork_handler)) };
+            FORK_HANDLER_REGISTERED.store(true, Ordering::Relaxed);
+        }
     }
 }
 
-#[cfg(not(all(unix, feature = "std", not(target_os = "emscripten"))))]
+#[cfg(not(all(feature="std", unix, not(target_os="emscripten"))))]
 mod fork {
-    pub fn get_fork_counter() -> usize {
-        0
-    }
+    pub fn get_fork_counter() -> usize { 0 }
     pub fn register_fork_handler() {}
 }
 
 
 #[cfg(test)]
 mod test {
+    use {Rng, SeedableRng};
+    use rand_chacha::ChaChaCore;
+    use rngs::mock::StepRng;
     use super::ReseedingRng;
-    use crate::rngs::mock::StepRng;
-    use crate::rngs::std::Core;
-    use crate::{Rng, SeedableRng};
 
     #[test]
     fn test_reseeding() {
         let mut zero = StepRng::new(0, 0);
-        let rng = Core::from_rng(&mut zero).unwrap();
-        let thresh = 1; // reseed every time the buffer is exhausted
-        let mut reseeding = ReseedingRng::new(rng, thresh, zero);
+        let rng = ChaChaCore::from_rng(&mut zero).unwrap();
+        let mut reseeding = ReseedingRng::new(rng, 32*4, zero);
 
-        // RNG buffer size is [u32; 64]
-        // Debug is only implemented up to length 32 so use two arrays
-        let mut buf = ([0u32; 32], [0u32; 32]);
-        reseeding.fill(&mut buf.0);
-        reseeding.fill(&mut buf.1);
+        // Currently we only support for arrays up to length 32.
+        // TODO: cannot generate seq via Rng::gen because it uses different alg
+        let mut buf = [0u32; 32]; // Needs to be a multiple of the RNGs result
+                                  // size to test exactly.
+        reseeding.fill(&mut buf);
         let seq = buf;
         for _ in 0..10 {
-            reseeding.fill(&mut buf.0);
-            reseeding.fill(&mut buf.1);
+            reseeding.fill(&mut buf);
             assert_eq!(buf, seq);
         }
     }
@@ -725,13 +729,11 @@
     #[test]
     fn test_clone_reseeding() {
         let mut zero = StepRng::new(0, 0);
-        let rng = Core::from_rng(&mut zero).unwrap();
-        let mut rng1 = ReseedingRng::new(rng, 32 * 4, zero);
+        let rng = ChaChaCore::from_rng(&mut zero).unwrap();
+        let mut rng1 = ReseedingRng::new(rng, 32*4, zero);
 
         let first: u32 = rng1.gen();
-        for _ in 0..10 {
-            let _ = rng1.gen::<u32>();
-        }
+        for _ in 0..10 { let _ = rng1.gen::<u32>(); }
 
         let mut rng2 = rng1.clone();
         assert_eq!(first, rng2.gen::<u32>());
diff --git a/src/rand/rngs/entropy.rs.html b/src/rand/rngs/entropy.rs.html
index 3fe2fdf..9c88023 100644
--- a/src/rand/rngs/entropy.rs.html
+++ b/src/rand/rngs/entropy.rs.html
@@ -1,79 +1,251 @@
-entropy.rs.html -- source
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
+entropy.rs.html -- source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -85,21 +257,51 @@
 
 //! Entropy generator, or wrapper around external generators
 
-#![allow(deprecated)] // whole module is deprecated
-
-use crate::rngs::OsRng;
-use rand_core::{CryptoRng, Error, RngCore};
+use rand_core::{RngCore, CryptoRng, Error, ErrorKind, impls};
+#[allow(unused)]
+use rngs;
 
 /// An interface returning random data from external source(s), provided
 /// specifically for securely seeding algorithmic generators (PRNGs).
 ///
-/// This is deprecated. It is suggested you use [`rngs::OsRng`] instead.
+/// Where possible, `EntropyRng` retrieves random data from the operating
+/// system's interface for random numbers ([`OsRng`]); if that fails it will
+/// fall back to the [`JitterRng`] entropy collector. In the latter case it will
+/// still try to use [`OsRng`] on the next usage.
 ///
-/// [`rngs::OsRng`]: crate::rngs::OsRng
+/// If no secure source of entropy is available `EntropyRng` will panic on use;
+/// i.e. it should never output predictable data.
+///
+/// This is either a little slow ([`OsRng`] requires a system call) or extremely
+/// slow ([`JitterRng`] must use significant CPU time to generate sufficient
+/// jitter); for better performance it is common to seed a local PRNG from
+/// external entropy then primarily use the local PRNG ([`thread_rng`] is
+/// provided as a convenient, local, automatically-seeded CSPRNG).
+///
+/// # Panics
+///
+/// On most systems, like Windows, Linux, macOS and *BSD on common hardware, it
+/// is highly unlikely for both [`OsRng`] and [`JitterRng`] to fail. But on
+/// combinations like webassembly without Emscripten or stdweb both sources are
+/// unavailable. If both sources fail, only [`try_fill_bytes`] is able to
+/// report the error, and only the one from `OsRng`. The other [`RngCore`]
+/// methods will panic in case of an error.
+///
+/// [`OsRng`]: rand_os::OsRng
+/// [`thread_rng`]: crate::thread_rng
+/// [`JitterRng`]: crate::rngs::JitterRng
+/// [`try_fill_bytes`]: RngCore::try_fill_bytes
 #[derive(Debug)]
-#[deprecated(since = "0.7.0", note = "use rngs::OsRng instead")]
 pub struct EntropyRng {
-    source: OsRng,
+    source: Source,
+}
+
+#[derive(Debug)]
+enum Source {
+    Os(Os),
+    Custom(Custom),
+    Jitter(Jitter),
+    None,
 }
 
 impl EntropyRng {
@@ -109,7 +311,7 @@
     /// those are done on first use. This is done to make `new` infallible,
     /// and `try_fill_bytes` the only place to report errors.
     pub fn new() -> Self {
-        EntropyRng { source: OsRng }
+        EntropyRng { source: Source::None }
     }
 }
 
@@ -121,25 +323,167 @@
 
 impl RngCore for EntropyRng {
     fn next_u32(&mut self) -> u32 {
-        self.source.next_u32()
+        impls::next_u32_via_fill(self)
     }
 
     fn next_u64(&mut self) -> u64 {
-        self.source.next_u64()
+        impls::next_u64_via_fill(self)
     }
 
     fn fill_bytes(&mut self, dest: &mut [u8]) {
-        self.source.fill_bytes(dest)
+        self.try_fill_bytes(dest).unwrap_or_else(|err|
+                panic!("all entropy sources failed; first error: {}", err))
     }
 
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        self.source.try_fill_bytes(dest)
+        let mut reported_error = None;
+
+        if let Source::Os(ref mut os_rng) = self.source {
+            match os_rng.fill(dest) {
+                Ok(()) => return Ok(()),
+                Err(err) => {
+                    warn!("EntropyRng: OsRng failed \
+                          [trying other entropy sources]: {}", err);
+                    reported_error = Some(err);
+                },
+            }
+        } else if Os::is_supported() {
+            match Os::new_and_fill(dest) {
+                Ok(os_rng) => {
+                    debug!("EntropyRng: using OsRng");
+                    self.source = Source::Os(os_rng);
+                    return Ok(());
+                },
+                Err(err) => { reported_error = reported_error.or(Some(err)) },
+            }
+        }
+
+        if let Source::Custom(ref mut rng) = self.source {
+            match rng.fill(dest) {
+                Ok(()) => return Ok(()),
+                Err(err) => {
+                    warn!("EntropyRng: custom entropy source failed \
+                          [trying other entropy sources]: {}", err);
+                    reported_error = Some(err);
+                },
+            }
+        } else if Custom::is_supported() {
+            match Custom::new_and_fill(dest) {
+                Ok(custom) => {
+                    debug!("EntropyRng: using custom entropy source");
+                    self.source = Source::Custom(custom);
+                    return Ok(());
+                },
+                Err(err) => { reported_error = reported_error.or(Some(err)) },
+            }
+        }
+
+        if let Source::Jitter(ref mut jitter_rng) = self.source {
+            match jitter_rng.fill(dest) {
+                Ok(()) => return Ok(()),
+                Err(err) => {
+                    warn!("EntropyRng: JitterRng failed: {}", err);
+                    reported_error = Some(err);
+                },
+            }
+        } else if Jitter::is_supported() {
+            match Jitter::new_and_fill(dest) {
+                Ok(jitter_rng) => {
+                    debug!("EntropyRng: using JitterRng");
+                    self.source = Source::Jitter(jitter_rng);
+                    return Ok(());
+                },
+                Err(err) => { reported_error = reported_error.or(Some(err)) },
+            }
+        }
+
+        if let Some(err) = reported_error {
+            Err(Error::with_cause(ErrorKind::Unavailable,
+                                  "All entropy sources failed",
+                                  err))
+        } else {
+            Err(Error::new(ErrorKind::Unavailable,
+                           "No entropy sources available"))
+        }
     }
 }
 
 impl CryptoRng for EntropyRng {}
 
 
+
+trait EntropySource {
+    fn new_and_fill(dest: &mut [u8]) -> Result<Self, Error>
+        where Self: Sized;
+
+    fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error>;
+
+    fn is_supported() -> bool { true }
+}
+
+#[allow(unused)]
+#[derive(Clone, Debug)]
+struct NoSource;
+
+#[allow(unused)]
+impl EntropySource for NoSource {
+    fn new_and_fill(dest: &mut [u8]) -> Result<Self, Error> {
+        Err(Error::new(ErrorKind::Unavailable, "Source not supported"))
+    }
+
+    fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+        unreachable!()
+    }
+
+    fn is_supported() -> bool { false }
+}
+
+
+#[cfg(feature="rand_os")]
+#[derive(Clone, Debug)]
+pub struct Os(rngs::OsRng);
+
+#[cfg(feature="rand_os")]
+impl EntropySource for Os {
+    fn new_and_fill(dest: &mut [u8]) -> Result<Self, Error> {
+        let mut rng = rngs::OsRng::new()?;
+        rng.try_fill_bytes(dest)?;
+        Ok(Os(rng))
+    }
+
+    fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+        self.0.try_fill_bytes(dest)
+    }
+}
+
+#[cfg(not(feature="std"))]
+type Os = NoSource;
+
+
+type Custom = NoSource;
+
+
+#[cfg(not(target_arch = "wasm32"))]
+#[derive(Clone, Debug)]
+pub struct Jitter(rngs::JitterRng);
+
+#[cfg(not(target_arch = "wasm32"))]
+impl EntropySource for Jitter {
+    fn new_and_fill(dest: &mut [u8]) -> Result<Self, Error> {
+        let mut rng = rngs::JitterRng::new()?;
+        rng.try_fill_bytes(dest)?;
+        Ok(Jitter(rng))
+    }
+
+    fn fill(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+        self.0.try_fill_bytes(dest)
+    }
+}
+
+#[cfg(target_arch = "wasm32")]
+type Jitter = NoSource;
+
+
 #[cfg(test)]
 mod test {
     use super::*;
@@ -148,7 +492,7 @@
     fn test_entropy() {
         let mut rng = EntropyRng::new();
         let n = (rng.next_u32() ^ rng.next_u32()).count_ones();
-        assert!(n >= 2); // p(failure) approx 1e-7
+        assert!(n >= 2);    // p(failure) approx 1e-7
     }
 }
 
diff --git a/src/rand/rngs/mock.rs.html b/src/rand/rngs/mock.rs.html index 20b955c..16a2153 100644 --- a/src/rand/rngs/mock.rs.html +++ b/src/rand/rngs/mock.rs.html @@ -1,4 +1,4 @@ -mock.rs.html -- source
 1
+mock.rs.html -- source
 1
  2
  3
  4
@@ -57,14 +57,6 @@
 57
 58
 59
-60
-61
-62
-63
-64
-65
-66
-67
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -76,18 +68,18 @@
 
 //! Mock random number generator
 
-use rand_core::{impls, Error, RngCore};
+use rand_core::{RngCore, Error, impls};
 
 /// A simple implementation of `RngCore` for testing purposes.
-///
+/// 
 /// This generates an arithmetic sequence (i.e. adds a constant each step)
 /// over a `u64` number, using wrapping arithmetic. If the increment is 0
 /// the generator yields a constant.
-///
+/// 
 /// ```
 /// use rand::Rng;
 /// use rand::rngs::mock::StepRng;
-///
+/// 
 /// let mut my_rng = StepRng::new(2, 1);
 /// let sample: [u64; 3] = my_rng.gen();
 /// assert_eq!(sample, [2, 3, 4]);
@@ -102,35 +94,27 @@
     /// Create a `StepRng`, yielding an arithmetic sequence starting with
     /// `initial` and incremented by `increment` each time.
     pub fn new(initial: u64, increment: u64) -> Self {
-        StepRng {
-            v: initial,
-            a: increment,
-        }
+        StepRng { v: initial, a: increment }
     }
 }
 
 impl RngCore for StepRng {
-    #[inline]
     fn next_u32(&mut self) -> u32 {
         self.next_u64() as u32
     }
 
-    #[inline]
     fn next_u64(&mut self) -> u64 {
         let result = self.v;
         self.v = self.v.wrapping_add(self.a);
         result
     }
 
-    #[inline]
     fn fill_bytes(&mut self, dest: &mut [u8]) {
         impls::fill_bytes_via_next(self, dest);
     }
 
-    #[inline]
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        self.fill_bytes(dest);
-        Ok(())
+        Ok(self.fill_bytes(dest))
     }
 }
 
diff --git a/src/rand/rngs/mod.rs.html b/src/rand/rngs/mod.rs.html index 1c9093d..ea86ebf 100644 --- a/src/rand/rngs/mod.rs.html +++ b/src/rand/rngs/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs.html -- source
  1
+mod.rs.html -- source
  1
   2
   3
   4
@@ -114,6 +114,57 @@
 114
 115
 116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -123,113 +174,164 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Random number generators and adapters
+//! Random number generators and adapters for common usage:
 //!
-//! ## Background: Random number generators (RNGs)
+//! - [`ThreadRng`], a fast, secure, auto-seeded thread-local generator
+//! - [`StdRng`] and [`SmallRng`], algorithms to cover typical usage
+//! - [`EntropyRng`], [`OsRng`] and [`JitterRng`] as entropy sources
+//! - [`mock::StepRng`] as a simple counter for tests
+//! - [`adapter::ReadRng`] to read from a file/stream
+//! - [`adapter::ReseedingRng`] to reseed a PRNG on clone / process fork etc.
 //!
-//! Computers cannot produce random numbers from nowhere. We classify
-//! random number generators as follows:
+//! # Background — Random number generators (RNGs)
 //!
-//! -   "True" random number generators (TRNGs) use hard-to-predict data sources
-//!     (e.g. the high-resolution parts of event timings and sensor jitter) to
-//!     harvest random bit-sequences, apply algorithms to remove bias and
-//!     estimate available entropy, then combine these bits into a byte-sequence
-//!     or an entropy pool. This job is usually done by the operating system or
-//!     a hardware generator (HRNG).
-//! -   "Pseudo"-random number generators (PRNGs) use algorithms to transform a
-//!     seed into a sequence of pseudo-random numbers. These generators can be
-//!     fast and produce well-distributed unpredictable random numbers (or not).
-//!     They are usually deterministic: given algorithm and seed, the output
-//!     sequence can be reproduced. They have finite period and eventually loop;
-//!     with many algorithms this period is fixed and can be proven sufficiently
-//!     long, while others are chaotic and the period depends on the seed.
-//! -   "Cryptographically secure" pseudo-random number generators (CSPRNGs)
-//!     are the sub-set of PRNGs which are secure. Security of the generator
-//!     relies both on hiding the internal state and using a strong algorithm.
+//! Computers are inherently deterministic, so to get *random* numbers one
+//! either has to use a hardware generator or collect bits of *entropy* from
+//! various sources (e.g. event timestamps, or jitter). This is a relatively
+//! slow and complicated operation.
 //!
-//! ## Traits and functionality
+//! Generally the operating system will collect some entropy, remove bias, and
+//! use that to seed its own PRNG; [`OsRng`] provides an interface to this.
+//! [`JitterRng`] is an entropy collector included with Rand that measures
+//! jitter in the CPU execution time, and jitter in memory access time.
+//! [`EntropyRng`] is a wrapper that uses the best entropy source that is
+//! available.
 //!
-//! All RNGs implement the [`RngCore`] trait, as a consequence of which the
-//! [`Rng`] extension trait is automatically implemented. Secure RNGs may
-//! additionally implement the [`CryptoRng`] trait.
+//! ## Pseudo-random number generators
 //!
-//! All PRNGs require a seed to produce their random number sequence. The
-//! [`SeedableRng`] trait provides three ways of constructing PRNGs:
+//! What is commonly used instead of "true" random number renerators, are
+//! *pseudo-random number generators* (PRNGs), deterministic algorithms that
+//! produce an infinite stream of pseudo-random numbers from a small random
+//! seed. PRNGs are faster, and have better provable properties. The numbers
+//! produced can be statistically of very high quality and can be impossible to
+//! predict. (They can also have obvious correlations and be trivial to predict;
+//! quality varies.)
 //!
-//! -   `from_seed` accepts a type specific to the PRNG
-//! -   `from_rng` allows a PRNG to be seeded from any other RNG
-//! -   `seed_from_u64` allows any PRNG to be seeded from a `u64` insecurely
-//! -   `from_entropy` securely seeds a PRNG from fresh entropy
+//! There are two different types of PRNGs: those developed for simulations
+//! and statistics, and those developed for use in cryptography; the latter are
+//! called Cryptographically Secure PRNGs (CSPRNG or CPRNG). Both types can
+//! have good statistical quality but the latter also have to be impossible to
+//! predict, even after seeing many previous output values. Rand provides a good
+//! default algorithm from each class:
 //!
-//! Use the [`rand_core`] crate when implementing your own RNGs.
+//! - [`SmallRng`] is a PRNG chosen for low memory usage, high performance and
+//!   good statistical quality.
+//! - [`StdRng`] is a CSPRNG chosen for good performance and trust of security
+//!   (based on reviews, maturity and usage). The current algorithm is HC-128,
+//!   which is one of the recommendations by ECRYPT's eSTREAM project.
 //!
-//! ## Our generators
+//! The above PRNGs do not cover all use-cases; more algorithms can be found in
+//! the [`prng`][crate::prng] module, as well as in several other crates. For example, you
+//! may wish a CSPRNG with significantly lower memory usage than [`StdRng`]
+//! while being less concerned about performance, in which case [`ChaChaRng`]
+//! is a good choice.
 //!
-//! This crate provides several random number generators:
+//! One complexity is that the internal state of a PRNG must change with every
+//! generated number. For APIs this generally means a mutable reference to the
+//! state of the PRNG has to be passed around.
 //!
-//! -   [`OsRng`] is an interface to the operating system's random number
-//!     source. Typically the operating system uses a CSPRNG with entropy
-//!     provided by a TRNG and some type of on-going re-seeding.
-//! -   [`ThreadRng`], provided by the [`thread_rng`] function, is a handle to a
-//!     thread-local CSPRNG with periodic seeding from [`OsRng`]. Because this
-//!     is local, it is typically much faster than [`OsRng`]. It should be
-//!     secure, though the paranoid may prefer [`OsRng`].
-//! -   [`StdRng`] is a CSPRNG chosen for good performance and trust of security
-//!     (based on reviews, maturity and usage). The current algorithm is ChaCha20,
-//!     which is well established and rigorously analysed.
-//!     [`StdRng`] provides the algorithm used by [`ThreadRng`] but without
-//!     periodic reseeding.
-//! -   [`SmallRng`] is an **insecure** PRNG designed to be fast, simple, require
-//!     little memory, and have good output quality.
+//! A solution is [`ThreadRng`]. This is a thread-local implementation of
+//! [`StdRng`] with automatic seeding on first use. It is the best choice if you
+//! "just" want a convenient, secure, fast random number source. Use via the
+//! [`thread_rng`] function, which gets a reference to the current thread's
+//! local instance.
 //!
-//! The algorithms selected for [`StdRng`] and [`SmallRng`] may change in any
-//! release and may be platform-dependent, therefore they should be considered
-//! **not reproducible**.
+//! ## Seeding
 //!
-//! ## Additional generators
+//! As mentioned above, PRNGs require a random seed in order to produce random
+//! output. This is especially important for CSPRNGs, which are still
+//! deterministic algorithms, thus can only be secure if their seed value is
+//! also secure. To seed a PRNG, use one of:
 //!
-//! **TRNGs**: The [`rdrand`] crate provides an interface to the RDRAND and
-//! RDSEED instructions available in modern Intel and AMD CPUs.
-//! The [`rand_jitter`] crate provides a user-space implementation of
-//! entropy harvesting from CPU timer jitter, but is very slow and has
-//! [security issues](https://github.com/rust-random/rand/issues/699).
+//! - [`FromEntropy::from_entropy`]; this is the most convenient way to seed
+//!   with fresh, secure random data.
+//! - [`SeedableRng::from_rng`]; this allows seeding from another PRNG or
+//!   from an entropy source such as [`EntropyRng`].
+//! - [`SeedableRng::from_seed`]; this is mostly useful if you wish to be able
+//!   to reproduce the output sequence by using a fixed seed. (Don't use
+//!   [`StdRng`] or [`SmallRng`] in this case since different algorithms may be
+//!   used by future versions of Rand; use an algorithm from the
+//!   [`prng`] module.)
 //!
-//! **PRNGs**: Several companion crates are available, providing individual or
-//! families of PRNG algorithms. These provide the implementations behind
-//! [`StdRng`] and [`SmallRng`] but can also be used directly, indeed *should*
-//! be used directly when **reproducibility** matters.
-//! Some suggestions are: [`rand_chacha`], [`rand_pcg`], [`rand_xoshiro`].
-//! A full list can be found by searching for crates with the [`rng` tag].
+//! ## Conclusion
 //!
-//! [`Rng`]: crate::Rng
-//! [`RngCore`]: crate::RngCore
-//! [`CryptoRng`]: crate::CryptoRng
-//! [`SeedableRng`]: crate::SeedableRng
-//! [`thread_rng`]: crate::thread_rng
-//! [`rdrand`]: https://crates.io/crates/rdrand
-//! [`rand_jitter`]: https://crates.io/crates/rand_jitter
-//! [`rand_chacha`]: https://crates.io/crates/rand_chacha
-//! [`rand_pcg`]: https://crates.io/crates/rand_pcg
-//! [`rand_xoshiro`]: https://crates.io/crates/rand_xoshiro
-//! [`rng` tag]: https://crates.io/keywords/rng
+//! - [`thread_rng`] is what you often want to use.
+//! - If you want more control, flexibility, or better performance, use
+//!   [`StdRng`], [`SmallRng`] or an algorithm from the [`prng`] module.
+//! - Use [`FromEntropy::from_entropy`] to seed new PRNGs.
+//! - If you need reproducibility, use [`SeedableRng::from_seed`] combined with
+//!   a named PRNG.
+//!
+//! More information and notes on cryptographic security can be found
+//! in the [`prng`] module.
+//!
+//! ## Examples
+//!
+//! Examples of seeding PRNGs:
+//!
+//! ```
+//! use rand::prelude::*;
+//! # use rand::Error;
+//!
+//! // StdRng seeded securely by the OS or local entropy collector:
+//! let mut rng = StdRng::from_entropy();
+//! # let v: u32 = rng.gen();
+//!
+//! // SmallRng seeded from thread_rng:
+//! # fn try_inner() -> Result<(), Error> {
+//! let mut rng = SmallRng::from_rng(thread_rng())?;
+//! # let v: u32 = rng.gen();
+//! # Ok(())
+//! # }
+//! # try_inner().unwrap();
+//!
+//! // SmallRng seeded by a constant, for deterministic results:
+//! let seed = [1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16]; // byte array
+//! let mut rng = SmallRng::from_seed(seed);
+//! # let v: u32 = rng.gen();
+//! ```
+//!
+//!
+//! # Implementing custom RNGs
+//!
+//! If you want to implement custom RNG, see the [`rand_core`] crate. The RNG
+//! will have to implement the [`RngCore`] trait, where the [`Rng`] trait is
+//! build on top of.
+//!
+//! If the RNG needs seeding, also implement the [`SeedableRng`] trait.
+//!
+//! [`CryptoRng`] is a marker trait cryptographically secure PRNGs can
+//! implement.
+//!
+//! [`OsRng`]: rand_os::OsRng
+//! [`SmallRng`]: rngs::SmallRng
+//! [`StdRng`]: rngs::StdRng
+//! [`ThreadRng`]: rngs::ThreadRng
+//! [`EntropyRng`]: rngs::EntropyRng
+//! [`JitterRng`]: rngs::JitterRng
+//! [`mock::StepRng`]: rngs::mock::StepRng
+//! [`adapter::ReadRng`]: rngs::adapter::ReadRng
+//! [`adapter::ReseedingRng`]: rngs::adapter::ReseedingRng
+//! [`ChaChaRng`]: rand_chacha::ChaChaRng
 
 pub mod adapter;
 
-#[cfg(feature = "std")] mod entropy;
-pub mod mock; // Public so we don't export `StepRng` directly, making it a bit
-              // more clear it is intended for testing.
-#[cfg(feature = "small_rng")] mod small;
+#[cfg(feature="std")] mod entropy;
+pub mod mock;   // Public so we don't export `StepRng` directly, making it a bit
+                // more clear it is intended for testing.
+mod small;
 mod std;
-#[cfg(feature = "std")] pub(crate) mod thread;
+#[cfg(feature="std")] pub(crate) mod thread;
 
-#[allow(deprecated)]
-#[cfg(feature = "std")]
-pub use self::entropy::EntropyRng;
 
-#[cfg(feature = "small_rng")] pub use self::small::SmallRng;
+pub use rand_jitter::{JitterRng, TimerError};
+#[cfg(feature="std")] pub use self::entropy::EntropyRng;
+
+pub use self::small::SmallRng;
 pub use self::std::StdRng;
-#[cfg(feature = "std")] pub use self::thread::ThreadRng;
+#[cfg(feature="std")] pub use self::thread::ThreadRng;
 
-#[cfg(feature = "getrandom")] pub use rand_core::OsRng;
+#[cfg(feature="rand_os")]
+pub use rand_os::OsRng;
 
\ No newline at end of file diff --git a/src/rand/rngs/std.rs.html b/src/rand/rngs/std.rs.html index 676b389..584c65d 100644 --- a/src/rand/rngs/std.rs.html +++ b/src/rand/rngs/std.rs.html @@ -1,106 +1,88 @@ -std.rs.html -- source
  1
-  2
-  3
-  4
-  5
-  6
-  7
-  8
-  9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
-100
-101
-102
-103
+std.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -112,32 +94,29 @@
 
 //! The standard RNG
 
-use crate::{CryptoRng, Error, RngCore, SeedableRng};
-
-#[cfg(all(any(test, feature = "std"), not(target_os = "emscripten")))]
-pub(crate) use rand_chacha::ChaCha20Core as Core;
-#[cfg(all(any(test, feature = "std"), target_os = "emscripten"))]
-pub(crate) use rand_hc::Hc128Core as Core;
-
-#[cfg(not(target_os = "emscripten"))] use rand_chacha::ChaCha20Rng as Rng;
-#[cfg(target_os = "emscripten")] use rand_hc::Hc128Rng as Rng;
+use {RngCore, CryptoRng, Error, SeedableRng};
+use rand_hc::Hc128Rng;
 
 /// The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient
 /// on the current platform, to be statistically strong and unpredictable
 /// (meaning a cryptographically secure PRNG).
 ///
-/// The current algorithm used is the ChaCha block cipher with 20 rounds.
-/// This may change as new evidence of cipher security and performance
-/// becomes available.
+/// The current algorithm used on all platforms is [HC-128], found in the
+/// [rand_hc] crate.
 ///
-/// The algorithm is deterministic but should not be considered reproducible
-/// due to dependence on configuration and possible replacement in future
-/// library versions. For a secure reproducible generator, we recommend use of
-/// the [rand_chacha] crate directly.
+/// Reproducibility of output from this generator is however not required, thus
+/// future library versions may use a different internal generator with
+/// different output. Further, this generator may not be portable and can
+/// produce different output depending on the architecture. If you require
+/// reproducible output, use a named RNG, for example [`ChaChaRng`] from the
+/// [rand_chacha] crate.
 ///
+/// [HC-128]: rand_hc::Hc128Rng
+/// [`ChaChaRng`]: rand_chacha::ChaChaRng
+/// [rand_hc]: https://crates.io/crates/rand_hc
 /// [rand_chacha]: https://crates.io/crates/rand_chacha
 #[derive(Clone, Debug)]
-pub struct StdRng(Rng);
+pub struct StdRng(Hc128Rng);
 
 impl RngCore for StdRng {
     #[inline(always)]
@@ -150,28 +129,24 @@
         self.0.next_u64()
     }
 
-    #[inline(always)]
     fn fill_bytes(&mut self, dest: &mut [u8]) {
         self.0.fill_bytes(dest);
     }
 
-    #[inline(always)]
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
         self.0.try_fill_bytes(dest)
     }
 }
 
 impl SeedableRng for StdRng {
-    type Seed = <Rng as SeedableRng>::Seed;
+    type Seed = <Hc128Rng as SeedableRng>::Seed;
 
-    #[inline(always)]
     fn from_seed(seed: Self::Seed) -> Self {
-        StdRng(Rng::from_seed(seed))
+        StdRng(Hc128Rng::from_seed(seed))
     }
 
-    #[inline(always)]
     fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error> {
-        Rng::from_rng(rng).map(StdRng)
+        Hc128Rng::from_rng(rng).map(StdRng)
     }
 }
 
@@ -180,29 +155,18 @@
 
 #[cfg(test)]
 mod test {
-    use crate::rngs::StdRng;
-    use crate::{RngCore, SeedableRng};
+    use {RngCore, SeedableRng};
+    use rngs::StdRng;
 
     #[test]
     fn test_stdrng_construction() {
-        // Test value-stability of StdRng. This is expected to break any time
-        // the algorithm is changed.
-        #[rustfmt::skip]
         let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0,
                     0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
+        let mut rng1 = StdRng::from_seed(seed);
+        assert_eq!(rng1.next_u64(), 15759097995037006553);
 
-        #[cfg(any(feature = "stdrng_strong", not(feature = "stdrng_fast")))]
-        let target = [3950704604716924505, 5573172343717151650];
-        #[cfg(all(not(feature = "stdrng_strong"), feature = "stdrng_fast"))]
-        let target = [10719222850664546238, 14064965282130556830];
-
-        let mut rng0 = StdRng::from_seed(seed);
-        let x0 = rng0.next_u64();
-
-        let mut rng1 = StdRng::from_rng(rng0).unwrap();
-        let x1 = rng1.next_u64();
-
-        assert_eq!([x0, x1], target);
+        let mut rng2 = StdRng::from_rng(rng1).unwrap();
+        assert_eq!(rng2.next_u64(), 6766915756997287454);
     }
 }
 
diff --git a/src/rand/rngs/thread.rs.html b/src/rand/rngs/thread.rs.html index 24b3314..b9cca6a 100644 --- a/src/rand/rngs/thread.rs.html +++ b/src/rand/rngs/thread.rs.html @@ -1,4 +1,4 @@ -thread.rs.html -- source
  1
+thread.rs.html -- source
  1
   2
   3
   4
@@ -122,6 +122,19 @@
 122
 123
 124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -134,12 +147,11 @@
 //! Thread-local random number generator
 
 use std::cell::UnsafeCell;
-use std::ptr::NonNull;
 
-use super::std::Core;
-use crate::rngs::adapter::ReseedingRng;
-use crate::rngs::OsRng;
-use crate::{CryptoRng, Error, RngCore, SeedableRng};
+use {RngCore, CryptoRng, SeedableRng, Error};
+use rngs::adapter::ReseedingRng;
+use rngs::EntropyRng;
+use rand_hc::Hc128Core;
 
 // Rationale for using `UnsafeCell` in `ThreadRng`:
 //
@@ -154,43 +166,59 @@
 // completely under our control. We just have to ensure none of them use
 // `ThreadRng` internally, which is nonsensical anyway. We should also never run
 // `ThreadRng` in destructors of its implementation, which is also nonsensical.
+//
+// The additional `Rc` is not strictly neccesary, and could be removed. For now
+// it ensures `ThreadRng` stays `!Send` and `!Sync`, and implements `Clone`.
 
 
-// Number of generated bytes after which to reseed `ThreadRng`.
-// According to benchmarks, reseeding has a noticable impact with thresholds
-// of 32 kB and less. We choose 64 kB to avoid significant overhead.
-const THREAD_RNG_RESEED_THRESHOLD: u64 = 1024 * 64;
+// Number of generated bytes after which to reseed `TreadRng`.
+//
+// The time it takes to reseed HC-128 is roughly equivalent to generating 7 KiB.
+// We pick a treshold here that is large enough to not reduce the average
+// performance too much, but also small enough to not make reseeding something
+// that basically never happens.
+const THREAD_RNG_RESEED_THRESHOLD: u64 = 32*1024*1024; // 32 MiB
 
 /// The type returned by [`thread_rng`], essentially just a reference to the
 /// PRNG in thread-local memory.
 ///
-/// `ThreadRng` uses the same PRNG as [`StdRng`] for security and performance.
-/// As hinted by the name, the generator is thread-local. `ThreadRng` is a
-/// handle to this generator and thus supports `Copy`, but not `Send` or `Sync`.
+/// `ThreadRng` uses [`ReseedingRng`] wrapping the same PRNG as [`StdRng`],
+/// which is reseeded after generating 32 MiB of random data. A single instance
+/// is cached per thread and the returned `ThreadRng` is a reference to this
+/// instance — hence `ThreadRng` is neither `Send` nor `Sync` but is safe to use
+/// within a single thread. This RNG is seeded and reseeded via [`EntropyRng`]
+/// as required.
 ///
-/// Unlike `StdRng`, `ThreadRng` uses the  [`ReseedingRng`] wrapper to reseed
-/// the PRNG from fresh entropy every 64 kiB of random data.
-/// [`OsRng`] is used to provide seed data.
+/// Note that the reseeding is done as an extra precaution against entropy
+/// leaks and is in theory unnecessary — to predict `ThreadRng`'s output, an
+/// attacker would have to either determine most of the RNG's seed or internal
+/// state, or crack the algorithm used.
 ///
-/// Note that the reseeding is done as an extra precaution against side-channel
-/// attacks and mis-use (e.g. if somehow weak entropy were supplied initially).
-/// The PRNG algorithms used are assumed to be secure.
+/// Like [`StdRng`], `ThreadRng` is a cryptographically secure PRNG. The current
+/// algorithm used is [HC-128], which is an array-based PRNG that trades memory
+/// usage for better performance. This makes it similar to ISAAC, the algorithm
+/// used in `ThreadRng` before rand 0.5.
 ///
+/// Cloning this handle just produces a new reference to the same thread-local
+/// generator.
+/// 
 /// [`ReseedingRng`]: crate::rngs::adapter::ReseedingRng
 /// [`StdRng`]: crate::rngs::StdRng
-#[derive(Copy, Clone, Debug)]
+/// [HC-128]: rand_hc::Hc128Rng
+#[derive(Clone, Debug)]
 pub struct ThreadRng {
-    // inner raw pointer implies type is neither Send nor Sync
-    rng: NonNull<ReseedingRng<Core, OsRng>>,
+    // use of raw pointer implies type is neither Send nor Sync
+    rng: *mut ReseedingRng<Hc128Core, EntropyRng>,
 }
 
 thread_local!(
-    static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Core, OsRng>> = {
-        let r = Core::from_rng(OsRng).unwrap_or_else(|err|
+    static THREAD_RNG_KEY: UnsafeCell<ReseedingRng<Hc128Core, EntropyRng>> = {
+        let mut entropy_source = EntropyRng::new();
+        let r = Hc128Core::from_rng(&mut entropy_source).unwrap_or_else(|err|
                 panic!("could not initialize thread_rng: {}", err));
         let rng = ReseedingRng::new(r,
                                     THREAD_RNG_RESEED_THRESHOLD,
-                                    OsRng);
+                                    entropy_source);
         UnsafeCell::new(rng)
     }
 );
@@ -199,38 +227,36 @@
 /// seeded by the system. Intended to be used in method chaining style,
 /// e.g. `thread_rng().gen::<i32>()`, or cached locally, e.g.
 /// `let mut rng = thread_rng();`.  Invoked by the `Default` trait, making
-/// `ThreadRng::default()` equivalent.
+/// `ThreadRng::default()` equivelent.
 ///
 /// For more information see [`ThreadRng`].
 pub fn thread_rng() -> ThreadRng {
-    let raw = THREAD_RNG_KEY.with(|t| t.get());
-    let nn = NonNull::new(raw).unwrap();
-    ThreadRng { rng: nn }
+    ThreadRng { rng: THREAD_RNG_KEY.with(|t| t.get()) }
 }
 
 impl Default for ThreadRng {
     fn default() -> ThreadRng {
-        crate::prelude::thread_rng()
+        ::prelude::thread_rng()
     }
 }
 
 impl RngCore for ThreadRng {
     #[inline(always)]
     fn next_u32(&mut self) -> u32 {
-        unsafe { self.rng.as_mut().next_u32() }
+        unsafe { (*self.rng).next_u32() }
     }
 
     #[inline(always)]
     fn next_u64(&mut self) -> u64 {
-        unsafe { self.rng.as_mut().next_u64() }
+        unsafe { (*self.rng).next_u64() }
     }
 
     fn fill_bytes(&mut self, dest: &mut [u8]) {
-        unsafe { self.rng.as_mut().fill_bytes(dest) }
+        unsafe { (*self.rng).fill_bytes(dest) }
     }
 
     fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        unsafe { self.rng.as_mut().try_fill_bytes(dest) }
+        unsafe { (*self.rng).try_fill_bytes(dest) }
     }
 }
 
@@ -241,8 +267,8 @@
 mod test {
     #[test]
     fn test_thread_rng() {
-        use crate::Rng;
-        let mut r = crate::thread_rng();
+        use Rng;
+        let mut r = ::thread_rng();
         r.gen::<i32>();
         assert_eq!(r.gen_range(0, 1), 0);
     }
diff --git a/src/rand/seq/index.rs.html b/src/rand/seq/index.rs.html
index 86925d7..f334d81 100644
--- a/src/rand/seq/index.rs.html
+++ b/src/rand/seq/index.rs.html
@@ -1,4 +1,4 @@
-index.rs.html -- source
  1
+index.rs.html -- source
  1
   2
   3
   4
@@ -376,66 +376,6 @@
 376
 377
 378
-379
-380
-381
-382
-383
-384
-385
-386
-387
-388
-389
-390
-391
-392
-393
-394
-395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
-411
-412
-413
-414
-415
-416
-417
-418
-419
-420
-421
-422
-423
-424
-425
-426
-427
-428
-429
-430
-431
-432
-433
-434
-435
-436
-437
-438
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -445,49 +385,34 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Low-level API for sampling indices
+//! Index sampling
 
-#[cfg(feature = "alloc")] use core::slice;
+#[cfg(feature="alloc")] use core::slice;
 
-#[cfg(all(feature = "alloc", not(feature = "std")))]
-use crate::alloc::vec::{self, Vec};
-#[cfg(feature = "std")] use std::vec;
+#[cfg(feature="std")] use std::vec;
+#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::{self, Vec};
 // BTreeMap is not as fast in tests, but better than nothing.
-#[cfg(all(feature = "alloc", not(feature = "std")))]
-use crate::alloc::collections::BTreeSet;
-#[cfg(feature = "std")] use std::collections::HashSet;
+#[cfg(feature="std")] use std::collections::{HashSet};
+#[cfg(all(feature="alloc", not(feature="std")))] use alloc::collections::BTreeSet;
 
-#[cfg(feature = "alloc")]
-use crate::distributions::{uniform::SampleUniform, Distribution, Uniform};
-use crate::Rng;
+#[cfg(feature="alloc")] use distributions::{Distribution, Uniform};
+use Rng;
 
 /// A vector of indices.
 ///
 /// Multiple internal representations are possible.
 #[derive(Clone, Debug)]
 pub enum IndexVec {
-    #[doc(hidden)]
-    U32(Vec<u32>),
-    #[doc(hidden)]
-    USize(Vec<usize>),
+    #[doc(hidden)] U32(Vec<u32>),
+    #[doc(hidden)] USize(Vec<usize>),
 }
 
 impl IndexVec {
     /// Returns the number of indices
-    #[inline]
     pub fn len(&self) -> usize {
-        match *self {
-            IndexVec::U32(ref v) => v.len(),
-            IndexVec::USize(ref v) => v.len(),
-        }
-    }
-
-    /// Returns `true` if the length is 0.
-    #[inline]
-    pub fn is_empty(&self) -> bool {
-        match *self {
-            IndexVec::U32(ref v) => v.is_empty(),
-            IndexVec::USize(ref v) => v.is_empty(),
+        match self {
+            &IndexVec::U32(ref v) => v.len(),
+            &IndexVec::USize(ref v) => v.len(),
         }
     }
 
@@ -495,16 +420,14 @@
     ///
     /// (Note: we cannot implement [`std::ops::Index`] because of lifetime
     /// restrictions.)
-    #[inline]
     pub fn index(&self, index: usize) -> usize {
-        match *self {
-            IndexVec::U32(ref v) => v[index] as usize,
-            IndexVec::USize(ref v) => v[index],
+        match self {
+            &IndexVec::U32(ref v) => v[index] as usize,
+            &IndexVec::USize(ref v) => v[index],
         }
     }
 
     /// Return result as a `Vec<usize>`. Conversion may or may not be trivial.
-    #[inline]
     pub fn into_vec(self) -> Vec<usize> {
         match self {
             IndexVec::U32(v) => v.into_iter().map(|i| i as usize).collect(),
@@ -513,16 +436,14 @@
     }
 
     /// Iterate over the indices as a sequence of `usize` values
-    #[inline]
-    pub fn iter(&self) -> IndexVecIter<'_> {
-        match *self {
-            IndexVec::U32(ref v) => IndexVecIter::U32(v.iter()),
-            IndexVec::USize(ref v) => IndexVecIter::USize(v.iter()),
+    pub fn iter<'a>(&'a self) -> IndexVecIter<'a> {
+        match self {
+            &IndexVec::U32(ref v) => IndexVecIter::U32(v.iter()),
+            &IndexVec::USize(ref v) => IndexVecIter::USize(v.iter()),
         }
     }
 
     /// Convert into an iterator over the indices as a sequence of `usize` values
-    #[inline]
     pub fn into_iter(self) -> IndexVecIntoIter {
         match self {
             IndexVec::U32(v) => IndexVecIntoIter::U32(v.into_iter()),
@@ -537,25 +458,21 @@
         match (self, other) {
             (&U32(ref v1), &U32(ref v2)) => v1 == v2,
             (&USize(ref v1), &USize(ref v2)) => v1 == v2,
-            (&U32(ref v1), &USize(ref v2)) => {
-                (v1.len() == v2.len()) && (v1.iter().zip(v2.iter()).all(|(x, y)| *x as usize == *y))
-            }
-            (&USize(ref v1), &U32(ref v2)) => {
-                (v1.len() == v2.len()) && (v1.iter().zip(v2.iter()).all(|(x, y)| *x == *y as usize))
-            }
+            (&U32(ref v1), &USize(ref v2)) => (v1.len() == v2.len())
+                && (v1.iter().zip(v2.iter()).all(|(x, y)| *x as usize == *y)),
+            (&USize(ref v1), &U32(ref v2)) => (v1.len() == v2.len())
+                && (v1.iter().zip(v2.iter()).all(|(x, y)| *x == *y as usize)),
         }
     }
 }
 
 impl From<Vec<u32>> for IndexVec {
-    #[inline]
     fn from(v: Vec<u32>) -> Self {
         IndexVec::U32(v)
     }
 }
 
 impl From<Vec<usize>> for IndexVec {
-    #[inline]
     fn from(v: Vec<usize>) -> Self {
         IndexVec::USize(v)
     }
@@ -564,29 +481,24 @@
 /// Return type of `IndexVec::iter`.
 #[derive(Debug)]
 pub enum IndexVecIter<'a> {
-    #[doc(hidden)]
-    U32(slice::Iter<'a, u32>),
-    #[doc(hidden)]
-    USize(slice::Iter<'a, usize>),
+    #[doc(hidden)] U32(slice::Iter<'a, u32>),
+    #[doc(hidden)] USize(slice::Iter<'a, usize>),
 }
 
 impl<'a> Iterator for IndexVecIter<'a> {
     type Item = usize;
-
-    #[inline]
     fn next(&mut self) -> Option<usize> {
         use self::IndexVecIter::*;
-        match *self {
-            U32(ref mut iter) => iter.next().map(|i| *i as usize),
-            USize(ref mut iter) => iter.next().cloned(),
+        match self {
+            &mut U32(ref mut iter) => iter.next().map(|i| *i as usize),
+            &mut USize(ref mut iter) => iter.next().cloned(),
         }
     }
 
-    #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
-        match *self {
-            IndexVecIter::U32(ref v) => v.size_hint(),
-            IndexVecIter::USize(ref v) => v.size_hint(),
+        match self {
+            &IndexVecIter::U32(ref v) => v.size_hint(),
+            &IndexVecIter::USize(ref v) => v.size_hint(),
         }
     }
 }
@@ -596,30 +508,26 @@
 /// Return type of `IndexVec::into_iter`.
 #[derive(Clone, Debug)]
 pub enum IndexVecIntoIter {
-    #[doc(hidden)]
-    U32(vec::IntoIter<u32>),
-    #[doc(hidden)]
-    USize(vec::IntoIter<usize>),
+    #[doc(hidden)] U32(vec::IntoIter<u32>),
+    #[doc(hidden)] USize(vec::IntoIter<usize>),
 }
 
 impl Iterator for IndexVecIntoIter {
     type Item = usize;
 
-    #[inline]
     fn next(&mut self) -> Option<Self::Item> {
         use self::IndexVecIntoIter::*;
-        match *self {
-            U32(ref mut v) => v.next().map(|i| i as usize),
-            USize(ref mut v) => v.next(),
+        match self {
+            &mut U32(ref mut v) => v.next().map(|i| i as usize),
+            &mut USize(ref mut v) => v.next(),
         }
     }
 
-    #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
         use self::IndexVecIntoIter::*;
-        match *self {
-            U32(ref v) => v.size_hint(),
-            USize(ref v) => v.size_hint(),
+        match self {
+            &U32(ref v) => v.size_hint(),
+            &USize(ref v) => v.size_hint(),
         }
     }
 }
@@ -644,13 +552,14 @@
 /// Note that performance is significantly better over `u32` indices than over
 /// `u64` indices. Because of this we hide the underlying type behind an
 /// abstraction, `IndexVec`.
-///
+/// 
 /// If an allocation-free `no_std` function is required, it is suggested
 /// to adapt the internal `sample_floyd` implementation.
 ///
 /// Panics if `amount > length`.
 pub fn sample<R>(rng: &mut R, length: usize, amount: usize) -> IndexVec
-where R: Rng + ?Sized {
+    where R: Rng + ?Sized,
+{
     if amount > length {
         panic!("`amount` of samples must be less than or equal to `length`");
     }
@@ -667,7 +576,7 @@
     // We do some calculations with f32. Accuracy is not very important.
 
     if amount < 163 {
-        const C: [[f32; 2]; 2] = [[1.6, 8.0 / 45.0], [10.0, 70.0 / 9.0]];
+        const C: [[f32; 2]; 2] = [[1.6, 8.0/45.0], [10.0, 70.0/9.0]];
         let j = if length < 500_000 { 0 } else { 1 };
         let amount_fp = amount as f32;
         let m4 = C[0][j] * amount_fp;
@@ -678,12 +587,14 @@
             sample_floyd(rng, length, amount)
         }
     } else {
-        const C: [f32; 2] = [270.0, 330.0 / 9.0];
+        const C: [f32; 2] = [270.0, 330.0/9.0];
         let j = if length < 500_000 { 0 } else { 1 };
         if (length as f32) < C[j] * (amount as f32) {
             sample_inplace(rng, length, amount)
         } else {
-            sample_rejection(rng, length, amount)
+            // note: could have a specific u32 impl, but I'm lazy and
+            // generics don't have usable conversions
+            sample_rejection(rng, length as usize, amount as usize)
         }
     }
 }
@@ -695,7 +606,8 @@
 ///
 /// This implementation uses `O(amount)` memory and `O(amount^2)` time.
 fn sample_floyd<R>(rng: &mut R, length: u32, amount: u32) -> IndexVec
-where R: Rng + ?Sized {
+    where R: Rng + ?Sized,
+{
     // For small amount we use Floyd's fully-shuffled variant. For larger
     // amounts this is slow due to Vec::insert performance, so we shuffle
     // afterwards. Benchmarks show little overhead from extra logic.
@@ -703,16 +615,18 @@
 
     debug_assert!(amount <= length);
     let mut indices = Vec::with_capacity(amount as usize);
-    for j in length - amount..length {
+    for j in length - amount .. length {
         let t = rng.gen_range(0, j + 1);
         if floyd_shuffle {
             if let Some(pos) = indices.iter().position(|&x| x == t) {
                 indices.insert(pos, j);
                 continue;
             }
-        } else if indices.contains(&t) {
-            indices.push(j);
-            continue;
+        } else {
+            if indices.contains(&t) {
+                indices.push(j);
+                continue;
+            }
         }
         indices.push(t);
     }
@@ -739,7 +653,8 @@
 ///
 /// Set-up is `O(length)` time and memory and shuffling is `O(amount)` time.
 fn sample_inplace<R>(rng: &mut R, length: u32, amount: u32) -> IndexVec
-where R: Rng + ?Sized {
+    where R: Rng + ?Sized,
+{
     debug_assert!(amount <= length);
     let mut indices: Vec<u32> = Vec::with_capacity(length as usize);
     indices.extend(0..length);
@@ -752,55 +667,21 @@
     IndexVec::from(indices)
 }
 
-trait UInt: Copy + PartialOrd + Ord + PartialEq + Eq + SampleUniform + core::hash::Hash {
-    fn zero() -> Self;
-    fn as_usize(self) -> usize;
-}
-impl UInt for u32 {
-    #[inline]
-    fn zero() -> Self {
-        0
-    }
-
-    #[inline]
-    fn as_usize(self) -> usize {
-        self as usize
-    }
-}
-impl UInt for usize {
-    #[inline]
-    fn zero() -> Self {
-        0
-    }
-
-    #[inline]
-    fn as_usize(self) -> usize {
-        self
-    }
-}
-
 /// Randomly sample exactly `amount` indices from `0..length`, using rejection
 /// sampling.
-///
+/// 
 /// Since `amount <<< length` there is a low chance of a random sample in
 /// `0..length` being a duplicate. We test for duplicates and resample where
 /// necessary. The algorithm is `O(amount)` time and memory.
-///
-/// This function  is generic over X primarily so that results are value-stable
-/// over 32-bit and 64-bit platforms.
-fn sample_rejection<X: UInt, R>(rng: &mut R, length: X, amount: X) -> IndexVec
-where
-    R: Rng + ?Sized,
-    IndexVec: From<Vec<X>>,
+fn sample_rejection<R>(rng: &mut R, length: usize, amount: usize) -> IndexVec
+    where R: Rng + ?Sized,
 {
     debug_assert!(amount < length);
-    #[cfg(feature = "std")]
-    let mut cache = HashSet::with_capacity(amount.as_usize());
-    #[cfg(not(feature = "std"))]
-    let mut cache = BTreeSet::new();
-    let distr = Uniform::new(X::zero(), length);
-    let mut indices = Vec::with_capacity(amount.as_usize());
-    for _ in 0..amount.as_usize() {
+    #[cfg(feature="std")] let mut cache = HashSet::with_capacity(amount);
+    #[cfg(not(feature="std"))] let mut cache = BTreeSet::new();
+    let distr = Uniform::new(0, length);
+    let mut indices = Vec::with_capacity(amount);
+    for _ in 0..amount {
         let mut pos = distr.sample(rng);
         while !cache.insert(pos) {
             pos = distr.sample(rng);
@@ -808,42 +689,41 @@
         indices.push(pos);
     }
 
-    debug_assert_eq!(indices.len(), amount.as_usize());
+    debug_assert_eq!(indices.len(), amount);
     IndexVec::from(indices)
 }
 
 #[cfg(test)]
 mod test {
     use super::*;
-    #[cfg(all(feature = "alloc", not(feature = "std")))] use crate::alloc::vec;
-    #[cfg(feature = "std")] use std::vec;
 
     #[test]
     fn test_sample_boundaries() {
-        let mut r = crate::test::rng(404);
+        let mut r = ::test::rng(404);
 
         assert_eq!(sample_inplace(&mut r, 0, 0).len(), 0);
         assert_eq!(sample_inplace(&mut r, 1, 0).len(), 0);
         assert_eq!(sample_inplace(&mut r, 1, 1).into_vec(), vec![0]);
 
-        assert_eq!(sample_rejection(&mut r, 1u32, 0).len(), 0);
+        assert_eq!(sample_rejection(&mut r, 1, 0).len(), 0);
 
         assert_eq!(sample_floyd(&mut r, 0, 0).len(), 0);
         assert_eq!(sample_floyd(&mut r, 1, 0).len(), 0);
         assert_eq!(sample_floyd(&mut r, 1, 1).into_vec(), vec![0]);
 
         // These algorithms should be fast with big numbers. Test average.
-        let sum: usize = sample_rejection(&mut r, 1 << 25, 10u32).into_iter().sum();
+        let sum: usize = sample_rejection(&mut r, 1 << 25, 10)
+                .into_iter().sum();
         assert!(1 << 25 < sum && sum < (1 << 25) * 25);
 
-        let sum: usize = sample_floyd(&mut r, 1 << 25, 10).into_iter().sum();
+        let sum: usize = sample_floyd(&mut r, 1 << 25, 10)
+                .into_iter().sum();
         assert!(1 << 25 < sum && sum < (1 << 25) * 25);
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_sample_alg() {
-        let seed_rng = crate::test::rng;
+        let seed_rng = ::test::rng;
 
         // We can't test which algorithm is used directly, but Floyd's alg
         // should produce different results from the others. (Also, `inplace`
@@ -861,16 +741,16 @@
         assert!(v1 != v3);
 
         // A large length and small amount should use Floyd
-        let (length, amount): (usize, usize) = (1 << 20, 50);
+        let (length, amount): (usize, usize) = (1<<20, 50);
         let v1 = sample(&mut seed_rng(421), length, amount);
         let v2 = sample_floyd(&mut seed_rng(421), length as u32, amount as u32);
         assert!(v1.iter().all(|e| e < length));
         assert_eq!(v1, v2);
 
         // A large length and larger amount should use cache
-        let (length, amount): (usize, usize) = (1 << 20, 600);
+        let (length, amount): (usize, usize) = (1<<20, 600);
         let v1 = sample(&mut seed_rng(422), length, amount);
-        let v2 = sample_rejection(&mut seed_rng(422), length as u32, amount as u32);
+        let v2 = sample_rejection(&mut seed_rng(422), length, amount);
         assert!(v1.iter().all(|e| e < length));
         assert_eq!(v1, v2);
     }
diff --git a/src/rand/seq/mod.rs.html b/src/rand/seq/mod.rs.html
index fbf8eac..3636f09 100644
--- a/src/rand/seq/mod.rs.html
+++ b/src/rand/seq/mod.rs.html
@@ -1,4 +1,4 @@
-mod.rs.html -- source
  1
+mod.rs.html -- source
  1
   2
   3
   4
@@ -827,27 +827,6 @@
 827
 828
 829
-830
-831
-832
-833
-834
-835
-836
-837
-838
-839
-840
-841
-842
-843
-844
-845
-846
-847
-848
-849
-850
 
 // Copyright 2018 Developers of the Rand project.
 //
@@ -857,64 +836,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Sequence-related functionality
-//!
-//! This module provides:
-//!
-//! *   [`SliceRandom`] slice sampling and mutation
-//! *   [`IteratorRandom`] iterator sampling
-//! *   [`index::sample`] low-level API to choose multiple indices from
-//!     `0..length`
-//!
-//! Also see:
-//!
-//! *   [`crate::distributions::weighted`] module which provides
-//!     implementations of weighted index sampling.
-//!
-//! In order to make results reproducible across 32-64 bit architectures, all
-//! `usize` indices are sampled as a `u32` where possible (also providing a
-//! small performance boost in some cases).
+//! Functions for randomly accessing and sampling sequences.
+//! 
+//! TODO: module doc
 
 
-#[cfg(feature = "alloc")] pub mod index;
+#[cfg(feature="alloc")] pub mod index;
 
-#[cfg(feature = "alloc")] use core::ops::Index;
+#[cfg(feature="alloc")] use core::ops::Index;
 
-#[cfg(all(feature = "alloc", not(feature = "std")))] use crate::alloc::vec::Vec;
+#[cfg(all(feature="alloc", not(feature="std")))] use alloc::vec::Vec;
 
-#[cfg(feature = "alloc")]
-use crate::distributions::uniform::{SampleBorrow, SampleUniform};
-#[cfg(feature = "alloc")] use crate::distributions::WeightedError;
-use crate::Rng;
+use Rng;
+#[cfg(feature="alloc")] use distributions::WeightedError;
+#[cfg(feature="alloc")] use distributions::uniform::{SampleUniform, SampleBorrow};
 
 /// Extension trait on slices, providing random mutation and sampling methods.
-///
-/// This trait is implemented on all `[T]` slice types, providing several
-/// methods for choosing and shuffling elements. You must `use` this trait:
-///
-/// ```
-/// use rand::seq::SliceRandom;
-///
-/// fn main() {
-///     let mut rng = rand::thread_rng();
-///     let mut bytes = "Hello, random!".to_string().into_bytes();
-///     bytes.shuffle(&mut rng);
-///     let str = String::from_utf8(bytes).unwrap();
-///     println!("{}", str);
-/// }
-/// ```
-/// Example output (non-deterministic):
-/// ```none
-/// l,nmroHado !le
-/// ```
+/// 
+/// An implementation is provided for slices. This may also be implementable for
+/// other types.
 pub trait SliceRandom {
     /// The element type.
     type Item;
 
     /// Returns a reference to one random element of the slice, or `None` if the
     /// slice is empty.
-    ///
-    /// For slices, complexity is `O(1)`.
+    /// 
+    /// Depending on the implementation, complexity is expected to be `O(1)`.
     ///
     /// # Example
     ///
@@ -928,33 +876,33 @@
     /// assert_eq!(choices[..0].choose(&mut rng), None);
     /// ```
     fn choose<R>(&self, rng: &mut R) -> Option<&Self::Item>
-    where R: Rng + ?Sized;
+        where R: Rng + ?Sized;
 
     /// Returns a mutable reference to one random element of the slice, or
     /// `None` if the slice is empty.
-    ///
-    /// For slices, complexity is `O(1)`.
+    /// 
+    /// Depending on the implementation, complexity is expected to be `O(1)`.
     fn choose_mut<R>(&mut self, rng: &mut R) -> Option<&mut Self::Item>
-    where R: Rng + ?Sized;
+        where R: Rng + ?Sized;
 
-    /// Chooses `amount` elements from the slice at random, without repetition,
-    /// and in random order. The returned iterator is appropriate both for
-    /// collection into a `Vec` and filling an existing buffer (see example).
-    ///
-    /// In case this API is not sufficiently flexible, use [`index::sample`].
-    ///
-    /// For slices, complexity is the same as [`index::sample`].
-    ///
+    /// Produces an iterator that chooses `amount` elements from the slice at
+    /// random without repeating any, and returns them in random order.
+    /// 
+    /// In case this API is not sufficiently flexible, use `index::sample` then
+    /// apply the indices to the slice.
+    /// 
+    /// Complexity is expected to be the same as `index::sample`.
+    /// 
     /// # Example
     /// ```
     /// use rand::seq::SliceRandom;
-    ///
+    /// 
     /// let mut rng = &mut rand::thread_rng();
     /// let sample = "Hello, audience!".as_bytes();
-    ///
+    /// 
     /// // collect the results into a vector:
     /// let v: Vec<u8> = sample.choose_multiple(&mut rng, 3).cloned().collect();
-    ///
+    /// 
     /// // store in a buffer:
     /// let mut buf = [0u8; 5];
     /// for (b, slot) in sample.choose_multiple(&mut rng, buf.len()).zip(buf.iter_mut()) {
@@ -963,18 +911,13 @@
     /// ```
     #[cfg(feature = "alloc")]
     fn choose_multiple<R>(&self, rng: &mut R, amount: usize) -> SliceChooseIter<Self, Self::Item>
-    where R: Rng + ?Sized;
+        where R: Rng + ?Sized;
 
-    /// Similar to [`choose`], but where the likelihood of each outcome may be
-    /// specified.
-    ///
-    /// The specified function `weight` maps each item `x` to a relative
+    /// Similar to [`choose`], where the likelihood of each outcome may be
+    /// specified. The specified function `weight` maps items `x` to a relative
     /// likelihood `weight(x)`. The probability of each item being selected is
     /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`.
     ///
-    /// For slices of length `n`, complexity is `O(n)`.
-    /// See also [`choose_weighted_mut`], [`distributions::weighted`].
-    ///
     /// # Example
     ///
     /// ```
@@ -986,58 +929,46 @@
     /// println!("{:?}", choices.choose_weighted(&mut rng, |item| item.1).unwrap().0);
     /// ```
     /// [`choose`]: SliceRandom::choose
-    /// [`choose_weighted_mut`]: SliceRandom::choose_weighted_mut
-    /// [`distributions::weighted`]: crate::distributions::weighted
     #[cfg(feature = "alloc")]
-    fn choose_weighted<R, F, B, X>(
-        &self, rng: &mut R, weight: F,
-    ) -> Result<&Self::Item, WeightedError>
-    where
-        R: Rng + ?Sized,
-        F: Fn(&Self::Item) -> B,
-        B: SampleBorrow<X>,
-        X: SampleUniform
-            + for<'a> ::core::ops::AddAssign<&'a X>
-            + ::core::cmp::PartialOrd<X>
-            + Clone
-            + Default;
+    fn choose_weighted<R, F, B, X>(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError>
+        where R: Rng + ?Sized,
+              F: Fn(&Self::Item) -> B,
+              B: SampleBorrow<X>,
+              X: SampleUniform +
+                 for<'a> ::core::ops::AddAssign<&'a X> +
+                 ::core::cmp::PartialOrd<X> +
+                 Clone +
+                 Default;
 
-    /// Similar to [`choose_mut`], but where the likelihood of each outcome may
-    /// be specified.
-    ///
-    /// The specified function `weight` maps each item `x` to a relative
+    /// Similar to [`choose_mut`], where the likelihood of each outcome may be
+    /// specified. The specified function `weight` maps items `x` to a relative
     /// likelihood `weight(x)`. The probability of each item being selected is
     /// therefore `weight(x) / s`, where `s` is the sum of all `weight(x)`.
     ///
-    /// For slices of length `n`, complexity is `O(n)`.
-    /// See also [`choose_weighted`], [`distributions::weighted`].
+    /// See also [`choose_weighted`].
     ///
     /// [`choose_mut`]: SliceRandom::choose_mut
     /// [`choose_weighted`]: SliceRandom::choose_weighted
-    /// [`distributions::weighted`]: crate::distributions::weighted
     #[cfg(feature = "alloc")]
-    fn choose_weighted_mut<R, F, B, X>(
-        &mut self, rng: &mut R, weight: F,
-    ) -> Result<&mut Self::Item, WeightedError>
-    where
-        R: Rng + ?Sized,
-        F: Fn(&Self::Item) -> B,
-        B: SampleBorrow<X>,
-        X: SampleUniform
-            + for<'a> ::core::ops::AddAssign<&'a X>
-            + ::core::cmp::PartialOrd<X>
-            + Clone
-            + Default;
+    fn choose_weighted_mut<R, F, B, X>(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError>
+        where R: Rng + ?Sized,
+              F: Fn(&Self::Item) -> B,
+              B: SampleBorrow<X>,
+              X: SampleUniform +
+                 for<'a> ::core::ops::AddAssign<&'a X> +
+                 ::core::cmp::PartialOrd<X> +
+                 Clone +
+                 Default;
 
     /// Shuffle a mutable slice in place.
-    ///
-    /// For slices of length `n`, complexity is `O(n)`.
+    /// 
+    /// Depending on the implementation, complexity is expected to be `O(1)`.
     ///
     /// # Example
     ///
     /// ```
-    /// use rand::seq::SliceRandom;
     /// use rand::thread_rng;
+    /// use rand::seq::SliceRandom;
     ///
     /// let mut rng = thread_rng();
     /// let mut y = [1, 2, 3, 4, 5];
@@ -1045,8 +976,7 @@
     /// y.shuffle(&mut rng);
     /// println!("Shuffled:   {:?}", y);
     /// ```
-    fn shuffle<R>(&mut self, rng: &mut R)
-    where R: Rng + ?Sized;
+    fn shuffle<R>(&mut self, rng: &mut R) where R: Rng + ?Sized;
 
     /// Shuffle a slice in place, but exit early.
     ///
@@ -1064,69 +994,47 @@
     /// If `amount` is greater than the number of elements in the slice, this
     /// will perform a full shuffle.
     ///
-    /// For slices, complexity is `O(m)` where `m = amount`.
-    fn partial_shuffle<R>(
-        &mut self, rng: &mut R, amount: usize,
-    ) -> (&mut [Self::Item], &mut [Self::Item])
-    where R: Rng + ?Sized;
+    /// Complexity is expected to be `O(m)` where `m = amount`.
+    fn partial_shuffle<R>(&mut self, rng: &mut R, amount: usize)
+        -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized;
 }
 
 /// Extension trait on iterators, providing random sampling methods.
-///
-/// This trait is implemented on all sized iterators, providing methods for
-/// choosing one or more elements. You must `use` this trait:
-///
-/// ```
-/// use rand::seq::IteratorRandom;
-///
-/// fn main() {
-///     let mut rng = rand::thread_rng();
-///     
-///     let faces = "😀😎😐😕😠😢";
-///     println!("I am {}!", faces.chars().choose(&mut rng).unwrap());
-/// }
-/// ```
-/// Example output (non-deterministic):
-/// ```none
-/// I am 😀!
-/// ```
 pub trait IteratorRandom: Iterator + Sized {
-    /// Choose one element at random from the iterator.
+    /// Choose one element at random from the iterator. If you have a slice,
+    /// it's significantly faster to call the [`choose`] or [`choose_mut`]
+    /// functions using the slice instead.
     ///
     /// Returns `None` if and only if the iterator is empty.
+    /// 
+    /// Complexity is `O(n)`, where `n` is the length of the iterator.
+    /// This likely consumes multiple random numbers, but the exact number
+    /// is unspecified.
     ///
-    /// This method uses [`Iterator::size_hint`] for optimisation. With an
-    /// accurate hint and where [`Iterator::nth`] is a constant-time operation
-    /// this method can offer `O(1)` performance. Where no size hint is
-    /// available, complexity is `O(n)` where `n` is the iterator length.
-    /// Partial hints (where `lower > 0`) also improve performance.
-    ///
-    /// For slices, prefer [`SliceRandom::choose`] which guarantees `O(1)`
-    /// performance.
+    /// [`choose`]: SliceRandom::method.choose
+    /// [`choose_mut`]: SliceRandom::choose_mut
     fn choose<R>(mut self, rng: &mut R) -> Option<Self::Item>
-    where R: Rng + ?Sized {
+        where R: Rng + ?Sized
+    {
         let (mut lower, mut upper) = self.size_hint();
         let mut consumed = 0;
         let mut result = None;
 
         if upper == Some(lower) {
-            return if lower == 0 {
-                None
-            } else {
-                self.nth(gen_index(rng, lower))
-            };
+            return if lower == 0 { None } else { self.nth(rng.gen_range(0, lower)) };
         }
 
         // Continue until the iterator is exhausted
         loop {
             if lower > 1 {
-                let ix = gen_index(rng, lower + consumed);
-                let skip = if ix < lower {
+                let ix = rng.gen_range(0, lower + consumed);
+                let skip;
+                if ix < lower {
                     result = self.nth(ix);
-                    lower - (ix + 1)
+                    skip = lower - (ix + 1);
                 } else {
-                    lower
-                };
+                    skip = lower;
+                }
                 if upper == Some(lower) {
                     return result;
                 }
@@ -1152,21 +1060,21 @@
         }
     }
 
-    /// Collects values at random from the iterator into a supplied buffer
-    /// until that buffer is filled.
-    ///
+    /// Collects `amount` values at random from the iterator into a supplied
+    /// buffer.
+    /// 
     /// Although the elements are selected randomly, the order of elements in
     /// the buffer is neither stable nor fully random. If random ordering is
     /// desired, shuffle the result.
-    ///
-    /// Returns the number of elements added to the buffer. This equals the length
-    /// of the buffer unless the iterator contains insufficient elements, in which
-    /// case this equals the number of elements available.
-    ///
+    /// 
+    /// Returns the number of elements added to the buffer. This equals `amount`
+    /// unless the iterator contains insufficient elements, in which case this
+    /// equals the number of elements available.
+    /// 
     /// Complexity is `O(n)` where `n` is the length of the iterator.
-    /// For slices, prefer [`SliceRandom::choose_multiple`].
-    fn choose_multiple_fill<R>(mut self, rng: &mut R, buf: &mut [Self::Item]) -> usize
-    where R: Rng + ?Sized {
+    fn choose_multiple_fill<R>(mut self, rng: &mut R, buf: &mut [Self::Item])
+        -> usize where R: Rng + ?Sized
+    {
         let amount = buf.len();
         let mut len = 0;
         while len < amount {
@@ -1181,7 +1089,7 @@
 
         // Continue, since the iterator was not exhausted
         for (i, elem) in self.enumerate() {
-            let k = gen_index(rng, i + 1 + amount);
+            let k = rng.gen_range(0, i + 1 + amount);
             if let Some(slot) = buf.get_mut(k) {
                 *slot = elem;
             }
@@ -1196,16 +1104,16 @@
     /// Although the elements are selected randomly, the order of elements in
     /// the buffer is neither stable nor fully random. If random ordering is
     /// desired, shuffle the result.
-    ///
+    /// 
     /// The length of the returned vector equals `amount` unless the iterator
     /// contains insufficient elements, in which case it equals the number of
     /// elements available.
-    ///
+    /// 
     /// Complexity is `O(n)` where `n` is the length of the iterator.
-    /// For slices, prefer [`SliceRandom::choose_multiple`].
     #[cfg(feature = "alloc")]
     fn choose_multiple<R>(mut self, rng: &mut R, amount: usize) -> Vec<Self::Item>
-    where R: Rng + ?Sized {
+        where R: Rng + ?Sized
+    {
         let mut reservoir = Vec::with_capacity(amount);
         reservoir.extend(self.by_ref().take(amount));
 
@@ -1215,7 +1123,7 @@
         // If the iterator stops once, then so do we.
         if reservoir.len() == amount {
             for (i, elem) in self.enumerate() {
-                let k = gen_index(rng, i + 1 + amount);
+                let k = rng.gen_range(0, i + 1 + amount);
                 if let Some(slot) = reservoir.get_mut(k) {
                     *slot = elem;
                 }
@@ -1234,27 +1142,31 @@
     type Item = T;
 
     fn choose<R>(&self, rng: &mut R) -> Option<&Self::Item>
-    where R: Rng + ?Sized {
+        where R: Rng + ?Sized
+    {
         if self.is_empty() {
             None
         } else {
-            Some(&self[gen_index(rng, self.len())])
+            Some(&self[rng.gen_range(0, self.len())])
         }
     }
 
     fn choose_mut<R>(&mut self, rng: &mut R) -> Option<&mut Self::Item>
-    where R: Rng + ?Sized {
+        where R: Rng + ?Sized
+    {
         if self.is_empty() {
             None
         } else {
             let len = self.len();
-            Some(&mut self[gen_index(rng, len)])
+            Some(&mut self[rng.gen_range(0, len)])
         }
     }
 
     #[cfg(feature = "alloc")]
-    fn choose_multiple<R>(&self, rng: &mut R, amount: usize) -> SliceChooseIter<Self, Self::Item>
-    where R: Rng + ?Sized {
+    fn choose_multiple<R>(&self, rng: &mut R, amount: usize)
+        -> SliceChooseIter<Self, Self::Item>
+        where R: Rng + ?Sized
+    {
         let amount = ::core::cmp::min(amount, self.len());
         SliceChooseIter {
             slice: self,
@@ -1264,66 +1176,57 @@
     }
 
     #[cfg(feature = "alloc")]
-    fn choose_weighted<R, F, B, X>(
-        &self, rng: &mut R, weight: F,
-    ) -> Result<&Self::Item, WeightedError>
-    where
-        R: Rng + ?Sized,
-        F: Fn(&Self::Item) -> B,
-        B: SampleBorrow<X>,
-        X: SampleUniform
-            + for<'a> ::core::ops::AddAssign<&'a X>
-            + ::core::cmp::PartialOrd<X>
-            + Clone
-            + Default,
-    {
-        use crate::distributions::{Distribution, WeightedIndex};
+    fn choose_weighted<R, F, B, X>(&self, rng: &mut R, weight: F) -> Result<&Self::Item, WeightedError>
+        where R: Rng + ?Sized,
+              F: Fn(&Self::Item) -> B,
+              B: SampleBorrow<X>,
+              X: SampleUniform +
+                 for<'a> ::core::ops::AddAssign<&'a X> +
+                 ::core::cmp::PartialOrd<X> +
+                 Clone +
+                 Default {
+        use distributions::{Distribution, WeightedIndex};
         let distr = WeightedIndex::new(self.iter().map(weight))?;
         Ok(&self[distr.sample(rng)])
     }
 
     #[cfg(feature = "alloc")]
-    fn choose_weighted_mut<R, F, B, X>(
-        &mut self, rng: &mut R, weight: F,
-    ) -> Result<&mut Self::Item, WeightedError>
-    where
-        R: Rng + ?Sized,
-        F: Fn(&Self::Item) -> B,
-        B: SampleBorrow<X>,
-        X: SampleUniform
-            + for<'a> ::core::ops::AddAssign<&'a X>
-            + ::core::cmp::PartialOrd<X>
-            + Clone
-            + Default,
-    {
-        use crate::distributions::{Distribution, WeightedIndex};
+    fn choose_weighted_mut<R, F, B, X>(&mut self, rng: &mut R, weight: F) -> Result<&mut Self::Item, WeightedError>
+        where R: Rng + ?Sized,
+              F: Fn(&Self::Item) -> B,
+              B: SampleBorrow<X>,
+              X: SampleUniform +
+                 for<'a> ::core::ops::AddAssign<&'a X> +
+                 ::core::cmp::PartialOrd<X> +
+                 Clone +
+                 Default {
+        use distributions::{Distribution, WeightedIndex};
         let distr = WeightedIndex::new(self.iter().map(weight))?;
         Ok(&mut self[distr.sample(rng)])
     }
 
-    fn shuffle<R>(&mut self, rng: &mut R)
-    where R: Rng + ?Sized {
+    fn shuffle<R>(&mut self, rng: &mut R) where R: Rng + ?Sized
+    {
         for i in (1..self.len()).rev() {
             // invariant: elements with index > i have been locked in place.
-            self.swap(i, gen_index(rng, i + 1));
+            self.swap(i, rng.gen_range(0, i + 1));
         }
     }
 
-    fn partial_shuffle<R>(
-        &mut self, rng: &mut R, amount: usize,
-    ) -> (&mut [Self::Item], &mut [Self::Item])
-    where R: Rng + ?Sized {
+    fn partial_shuffle<R>(&mut self, rng: &mut R, amount: usize)
+        -> (&mut [Self::Item], &mut [Self::Item]) where R: Rng + ?Sized
+    {
         // This applies Durstenfeld's algorithm for the
         // [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm)
         // for an unbiased permutation, but exits early after choosing `amount`
         // elements.
-
+        
         let len = self.len();
         let end = if amount >= len { 0 } else { len - amount };
-
+        
         for i in (end..len).rev() {
             // invariant: elements with index > i have been locked in place.
-            self.swap(i, gen_index(rng, i + 1));
+            self.swap(i, rng.gen_range(0, i + 1));
         }
         let r = self.split_at_mut(end);
         (r.1, r.0)
@@ -1333,10 +1236,7 @@
 impl<I> IteratorRandom for I where I: Iterator + Sized {}
 
 
-/// An iterator over multiple slice elements.
-///
-/// This struct is created by
-/// [`SliceRandom::choose_multiple`](trait.SliceRandom.html#tymethod.choose_multiple).
+/// Iterator over multiple choices, as returned by [`SliceRandom::choose_multiple]
 #[cfg(feature = "alloc")]
 #[derive(Debug)]
 pub struct SliceChooseIter<'a, S: ?Sized + 'a, T: 'a> {
@@ -1353,7 +1253,7 @@
         // TODO: investigate using SliceIndex::get_unchecked when stable
         self.indices.next().map(|i| &self.slice[i as usize])
     }
-
+    
     fn size_hint(&self) -> (usize, Option<usize>) {
         (self.indices.len(), Some(self.indices.len()))
     }
@@ -1369,40 +1269,88 @@
 }
 
 
-// Sample a number uniformly between 0 and `ubound`. Uses 32-bit sampling where
-// possible, primarily in order to produce the same output on 32-bit and 64-bit
-// platforms.
-#[inline]
-fn gen_index<R: Rng + ?Sized>(rng: &mut R, ubound: usize) -> usize {
-    if ubound <= (core::u32::MAX as usize) {
-        rng.gen_range(0, ubound as u32) as usize
+/// Randomly sample `amount` elements from a finite iterator.
+///
+/// Deprecated: use [`IteratorRandom::choose_multiple`] instead.
+#[cfg(feature = "alloc")]
+#[deprecated(since="0.6.0", note="use IteratorRandom::choose_multiple instead")]
+pub fn sample_iter<T, I, R>(rng: &mut R, iterable: I, amount: usize) -> Result<Vec<T>, Vec<T>>
+    where I: IntoIterator<Item=T>,
+          R: Rng + ?Sized,
+{
+    use seq::IteratorRandom;
+    let iter = iterable.into_iter();
+    let result = iter.choose_multiple(rng, amount);
+    if result.len() == amount {
+        Ok(result)
     } else {
-        rng.gen_range(0, ubound)
+        Err(result)
     }
 }
 
+/// Randomly sample exactly `amount` values from `slice`.
+///
+/// The values are non-repeating and in random order.
+///
+/// This implementation uses `O(amount)` time and memory.
+///
+/// Panics if `amount > slice.len()`
+///
+/// Deprecated: use [`SliceRandom::choose_multiple`] instead.
+#[cfg(feature = "alloc")]
+#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")]
+pub fn sample_slice<R, T>(rng: &mut R, slice: &[T], amount: usize) -> Vec<T>
+    where R: Rng + ?Sized,
+          T: Clone
+{
+    let indices = index::sample(rng, slice.len(), amount).into_iter();
+
+    let mut out = Vec::with_capacity(amount);
+    out.extend(indices.map(|i| slice[i].clone()));
+    out
+}
+
+/// Randomly sample exactly `amount` references from `slice`.
+///
+/// The references are non-repeating and in random order.
+///
+/// This implementation uses `O(amount)` time and memory.
+///
+/// Panics if `amount > slice.len()`
+///
+/// Deprecated: use [`SliceRandom::choose_multiple`] instead.
+#[cfg(feature = "alloc")]
+#[deprecated(since="0.6.0", note="use SliceRandom::choose_multiple instead")]
+pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) -> Vec<&'a T>
+    where R: Rng + ?Sized
+{
+    let indices = index::sample(rng, slice.len(), amount).into_iter();
+
+    let mut out = Vec::with_capacity(amount);
+    out.extend(indices.map(|i| &slice[i]));
+    out
+}
 
 #[cfg(test)]
 mod test {
     use super::*;
-    #[cfg(feature = "alloc")] use crate::Rng;
-    #[cfg(all(feature = "alloc", not(feature = "std")))] use alloc::vec::Vec;
+    #[cfg(feature = "alloc")] use {Rng, SeedableRng};
+    #[cfg(feature = "alloc")] use rngs::SmallRng;
+    #[cfg(all(feature="alloc", not(feature="std")))]
+    use alloc::vec::Vec;
 
     #[test]
     fn test_slice_choose() {
-        let mut r = crate::test::rng(107);
-        let chars = [
-            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
-        ];
+        let mut r = ::test::rng(107);
+        let chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'];
         let mut chosen = [0i32; 14];
-        // The below all use a binomial distribution with n=1000, p=1/14.
-        // binocdf(40, 1000, 1/14) ~= 2e-5; 1-binocdf(106, ..) ~= 2e-5
         for _ in 0..1000 {
             let picked = *chars.choose(&mut r).unwrap();
             chosen[(picked as usize) - ('a' as usize)] += 1;
         }
         for count in chosen.iter() {
-            assert!(40 < *count && *count < 106);
+            let err = *count - (1000 / (chars.len() as i32));
+            assert!(-20 <= err && err <= 20);
         }
 
         chosen.iter_mut().for_each(|x| *x = 0);
@@ -1410,7 +1358,8 @@
             *chosen.choose_mut(&mut r).unwrap() += 1;
         }
         for count in chosen.iter() {
-            assert!(40 < *count && *count < 106);
+            let err = *count - (1000 / (chosen.len() as i32));
+            assert!(-20 <= err && err <= 20);
         }
 
         let mut v: [isize; 0] = [];
@@ -1424,7 +1373,6 @@
     }
     impl<I: Iterator + Clone> Iterator for UnhintedIterator<I> {
         type Item = I::Item;
-
         fn next(&mut self) -> Option<Self::Item> {
             self.iter.next()
         }
@@ -1439,25 +1387,18 @@
     }
     impl<I: ExactSizeIterator + Iterator + Clone> Iterator for ChunkHintedIterator<I> {
         type Item = I::Item;
-
         fn next(&mut self) -> Option<Self::Item> {
             if self.chunk_remaining == 0 {
-                self.chunk_remaining = ::core::cmp::min(self.chunk_size, self.iter.len());
+                self.chunk_remaining = ::core::cmp::min(self.chunk_size,
+                                                        self.iter.len());
             }
             self.chunk_remaining = self.chunk_remaining.saturating_sub(1);
 
             self.iter.next()
         }
-
         fn size_hint(&self) -> (usize, Option<usize>) {
-            (
-                self.chunk_remaining,
-                if self.hint_total_size {
-                    Some(self.iter.len())
-                } else {
-                    None
-                },
-            )
+            (self.chunk_remaining,
+             if self.hint_total_size { Some(self.iter.len()) } else { None })
         }
     }
 
@@ -1469,28 +1410,19 @@
     }
     impl<I: ExactSizeIterator + Iterator + Clone> Iterator for WindowHintedIterator<I> {
         type Item = I::Item;
-
         fn next(&mut self) -> Option<Self::Item> {
             self.iter.next()
         }
-
         fn size_hint(&self) -> (usize, Option<usize>) {
-            (
-                ::core::cmp::min(self.iter.len(), self.window_size),
-                if self.hint_total_size {
-                    Some(self.iter.len())
-                } else {
-                    None
-                },
-            )
+            (::core::cmp::min(self.iter.len(), self.window_size),
+             if self.hint_total_size { Some(self.iter.len()) } else { None })
         }
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_iterator_choose() {
-        let r = &mut crate::test::rng(109);
-        fn test_iter<R: Rng + ?Sized, Iter: Iterator<Item = usize> + Clone>(r: &mut R, iter: Iter) {
+        let r = &mut ::test::rng(109);
+        fn test_iter<R: Rng + ?Sized, Iter: Iterator<Item=usize> + Clone>(r: &mut R, iter: Iter) {
             let mut chosen = [0i32; 9];
             for _ in 0..1000 {
                 let picked = iter.clone().choose(r).unwrap();
@@ -1500,11 +1432,7 @@
                 // Samples should follow Binomial(1000, 1/9)
                 // Octave: binopdf(x, 1000, 1/9) gives the prob of *count == x
                 // Note: have seen 153, which is unlikely but not impossible.
-                assert!(
-                    72 < *count && *count < 154,
-                    "count not close to 1000/9: {}",
-                    count
-                );
+                assert!(72 < *count && *count < 154, "count not close to 1000/9: {}", count);
             }
         }
 
@@ -1513,37 +1441,18 @@
         #[cfg(feature = "alloc")]
         test_iter(r, (0..9).collect::<Vec<_>>().into_iter());
         test_iter(r, UnhintedIterator { iter: 0..9 });
-        test_iter(r, ChunkHintedIterator {
-            iter: 0..9,
-            chunk_size: 4,
-            chunk_remaining: 4,
-            hint_total_size: false,
-        });
-        test_iter(r, ChunkHintedIterator {
-            iter: 0..9,
-            chunk_size: 4,
-            chunk_remaining: 4,
-            hint_total_size: true,
-        });
-        test_iter(r, WindowHintedIterator {
-            iter: 0..9,
-            window_size: 2,
-            hint_total_size: false,
-        });
-        test_iter(r, WindowHintedIterator {
-            iter: 0..9,
-            window_size: 2,
-            hint_total_size: true,
-        });
+        test_iter(r, ChunkHintedIterator { iter: 0..9, chunk_size: 4, chunk_remaining: 4, hint_total_size: false });
+        test_iter(r, ChunkHintedIterator { iter: 0..9, chunk_size: 4, chunk_remaining: 4, hint_total_size: true });
+        test_iter(r, WindowHintedIterator { iter: 0..9, window_size: 2, hint_total_size: false });
+        test_iter(r, WindowHintedIterator { iter: 0..9, window_size: 2, hint_total_size: true });
 
         assert_eq!((0..0).choose(r), None);
-        assert_eq!(UnhintedIterator { iter: 0..0 }.choose(r), None);
+        assert_eq!(UnhintedIterator{ iter: 0..0 }.choose(r), None);
     }
 
     #[test]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
     fn test_shuffle() {
-        let mut r = crate::test::rng(108);
+        let mut r = ::test::rng(108);
         let empty: &mut [isize] = &mut [];
         empty.shuffle(&mut r);
         let mut one = [1];
@@ -1583,21 +1492,19 @@
             counts[permutation] += 1;
         }
         for count in counts.iter() {
-            // Binomial(10000, 1/24) with average 416.667
-            // Octave: binocdf(n, 10000, 1/24)
-            // 99.9% chance samples lie within this range:
-            assert!(352 <= *count && *count <= 483, "count: {}", count);
+            let err = *count - 10000i32 / 24;
+            assert!(-50 <= err && err <= 50);
         }
     }
-
+    
     #[test]
     fn test_partial_shuffle() {
-        let mut r = crate::test::rng(118);
-
+        let mut r = ::test::rng(118);
+        
         let mut empty: [u32; 0] = [];
         let res = empty.partial_shuffle(&mut r, 10);
         assert_eq!((res.0.len(), res.1.len()), (0, 0));
-
+        
         let mut v = [1, 2, 3, 4, 5];
         let res = v.partial_shuffle(&mut r, 2);
         assert_eq!((res.0.len(), res.1.len()), (2, 3));
@@ -1612,7 +1519,7 @@
         let min_val = 1;
         let max_val = 100;
 
-        let mut r = crate::test::rng(401);
+        let mut r = ::test::rng(401);
         let vals = (min_val..max_val).collect::<Vec<i32>>();
         let small_sample = vals.iter().choose_multiple(&mut r, 5);
         let large_sample = vals.iter().choose_multiple(&mut r, vals.len() + 5);
@@ -1622,16 +1529,82 @@
         // no randomization happens when amount >= len
         assert_eq!(large_sample, vals.iter().collect::<Vec<_>>());
 
-        assert!(small_sample
-            .iter()
-            .all(|e| { **e >= min_val && **e <= max_val }));
+        assert!(small_sample.iter().all(|e| {
+            **e >= min_val && **e <= max_val
+        }));
+    }
+    
+    #[test]
+    #[cfg(feature = "alloc")]
+    #[allow(deprecated)]
+    fn test_sample_slice_boundaries() {
+        let empty: &[u8] = &[];
+
+        let mut r = ::test::rng(402);
+
+        // sample 0 items
+        assert_eq!(&sample_slice(&mut r, empty, 0)[..], [0u8; 0]);
+        assert_eq!(&sample_slice(&mut r, &[42, 2, 42], 0)[..], [0u8; 0]);
+
+        // sample 1 item
+        assert_eq!(&sample_slice(&mut r, &[42], 1)[..], [42]);
+        let v = sample_slice(&mut r, &[1, 42], 1)[0];
+        assert!(v == 1 || v == 42);
+
+        // sample "all" the items
+        let v = sample_slice(&mut r, &[42, 133], 2);
+        assert!(&v[..] == [42, 133] || v[..] == [133, 42]);
+
+        // Make sure lucky 777's aren't lucky
+        let slice = &[42, 777];
+        let mut num_42 = 0;
+        let total = 1000;
+        for _ in 0..total {
+            let v = sample_slice(&mut r, slice, 1);
+            assert_eq!(v.len(), 1);
+            let v = v[0];
+            assert!(v == 42 || v == 777);
+            if v == 42 {
+                num_42 += 1;
+            }
+        }
+        let ratio_42 = num_42 as f64 / 1000 as f64;
+        assert!(0.4 <= ratio_42 || ratio_42 <= 0.6, "{}", ratio_42);
     }
 
     #[test]
     #[cfg(feature = "alloc")]
-    #[cfg_attr(miri, ignore)] // Miri is too slow
+    #[allow(deprecated)]
+    fn test_sample_slice() {
+        let seeded_rng = SmallRng::from_seed;
+
+        let mut r = ::test::rng(403);
+
+        for n in 1..20 {
+            let length = 5*n - 4;   // 1, 6, ...
+            let amount = r.gen_range(0, length);
+            let mut seed = [0u8; 16];
+            r.fill(&mut seed);
+
+            // assert the basics work
+            let regular = index::sample(&mut seeded_rng(seed), length, amount);
+            assert_eq!(regular.len(), amount);
+            assert!(regular.iter().all(|e| e < length));
+
+            // also test that sampling the slice works
+            let vec: Vec<u32> = (0..(length as u32)).collect();
+            let result = sample_slice(&mut seeded_rng(seed), &vec, amount);
+            assert_eq!(result, regular.iter().map(|i| i as u32).collect::<Vec<_>>());
+
+            let result = sample_slice_ref(&mut seeded_rng(seed), &vec, amount);
+            assert!(result.iter().zip(regular.iter()).all(|(i,j)| **i == j as u32));
+        }
+    }
+    
+    #[test]
+    #[cfg(feature = "alloc")]
     fn test_weighted() {
-        let mut r = crate::test::rng(406);
+        let mut r = ::test::rng(406);
         const N_REPS: u32 = 3000;
         let weights = [1u32, 2, 3, 0, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7];
         let total_weight = weights.iter().sum::<u32>() as f32;
@@ -1677,26 +1650,11 @@
 
         // Check error cases
         let empty_slice = &mut [10][0..0];
-        assert_eq!(
-            empty_slice.choose_weighted(&mut r, |_| 1),
-            Err(WeightedError::NoItem)
-        );
-        assert_eq!(
-            empty_slice.choose_weighted_mut(&mut r, |_| 1),
-            Err(WeightedError::NoItem)
-        );
-        assert_eq!(
-            ['x'].choose_weighted_mut(&mut r, |_| 0),
-            Err(WeightedError::AllWeightsZero)
-        );
-        assert_eq!(
-            [0, -1].choose_weighted_mut(&mut r, |x| *x),
-            Err(WeightedError::InvalidWeight)
-        );
-        assert_eq!(
-            [-1, 0].choose_weighted_mut(&mut r, |x| *x),
-            Err(WeightedError::InvalidWeight)
-        );
+        assert_eq!(empty_slice.choose_weighted(&mut r, |_| 1), Err(WeightedError::NoItem));
+        assert_eq!(empty_slice.choose_weighted_mut(&mut r, |_| 1), Err(WeightedError::NoItem));
+        assert_eq!(['x'].choose_weighted_mut(&mut r, |_| 0), Err(WeightedError::AllWeightsZero));
+        assert_eq!([0, -1].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight));
+        assert_eq!([-1, 0].choose_weighted_mut(&mut r, |x| *x), Err(WeightedError::NegativeWeight));
     }
 }