|
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A random number generator that can be explicitly seeded."><meta name="keywords" content="rust, rustlang, rust-lang, SeedableRng"><title>SeedableRng in rand - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
|
|
|
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../rand/index.html"><div class="logo-container"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></div>
|
|
|
</a><h2 class="location"></h2>
|
|
|
</nav>
|
|
|
<nav class="sidebar"><a class="sidebar-logo" href="../rand/index.html"><div class="logo-container">
|
|
|
<img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></div>
|
|
|
</a><h2 class="location"><a href="#">SeedableRng</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-associated-types">Required Associated Types</a></h3><ul><li><a href="#associatedtype.Seed">Seed</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.from_seed">from_seed</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#provided-methods">Provided Methods</a></h3><ul><li><a href="#method.from_entropy">from_entropy</a></li><li><a href="#method.from_rng">from_rng</a></li><li><a href="#method.seed_from_u64">seed_from_u64</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-SeedableRng-for-BlockRng64%3CR%3E">BlockRng64<R></a></li><li><a href="#impl-SeedableRng-for-BlockRng%3CR%3E">BlockRng<R></a></li><li><a href="#impl-SeedableRng-for-ChaCha12Core">ChaCha12Core</a></li><li><a href="#impl-SeedableRng-for-ChaCha12Rng">ChaCha12Rng</a></li><li><a href="#impl-SeedableRng-for-ChaCha20Core">ChaCha20Core</a></li><li><a href="#impl-SeedableRng-for-ChaCha20Rng">ChaCha20Rng</a></li><li><a href="#impl-SeedableRng-for-ChaCha8Core">ChaCha8Core</a></li><li><a href="#impl-SeedableRng-for-ChaCha8Rng">ChaCha8Rng</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In rand</a></h2><div id="sidebar-vars" data-name="SeedableRng" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../rand/index.html">
|
|
|
<img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><nav class="sub"><div class="theme-picker hidden"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="22" height="22" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
|
|
<h1 class="fqn"><span class="in-band">Trait <a href="index.html">rand</a>::<wbr><a class="trait" href="#">SeedableRng</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/rand_core/lib.rs.html#217-390">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait SeedableRng {
|
|
|
type <a href="#associatedtype.Seed" class="associatedtype">Seed</a>: <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.slice.html">]</a>>;
|
|
|
|
|
|
fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: Self::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> Self;
|
|
|
|
|
|
fn <a href="#method.seed_from_u64" class="fnname">seed_from_u64</a>(state: <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u64.html">u64</a>) -> Self { ... }
|
|
|
<span class="item-spacer"></span> fn <a href="#method.from_rng" class="fnname">from_rng</a><R>(rng: R) -> <a class="enum" href="https://doc.rust-lang.org/1.62.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, <a class="struct" href="struct.Error.html" title="struct rand::Error">Error</a>><br> <span class="where">where<br> R: <a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a></span>,
|
|
|
{ ... }
|
|
|
<span class="item-spacer"></span> fn <a href="#method.from_entropy" class="fnname">from_entropy</a>() -> Self { ... }
|
|
|
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A random number generator that can be explicitly seeded.</p>
|
|
|
<p>This trait encapsulates the low-level functionality common to all
|
|
|
pseudo-random number generators (PRNGs, or algorithmic generators).</p>
|
|
|
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Seed" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/rand_core/lib.rs.html#263">source</a></div><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a>: <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.62.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><<a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.slice.html">]</a>></h4></div></summary><div class="docblock"><p>Seed type, which is restricted to types mutably-dereferencable as <code>u8</code>
|
|
|
arrays (we recommend <code>[u8; N]</code> for some <code>N</code>).</p>
|
|
|
<p>It is recommended to seed PRNGs with a seed of at least circa 100 bits,
|
|
|
which means an array of <code>[u8; 12]</code> or greater to avoid picking RNGs with
|
|
|
partially overlapping periods.</p>
|
|
|
<p>For cryptographic RNG’s a seed of 256 bits is recommended, <code>[u8; 32]</code>.</p>
|
|
|
<h5 id="implementing-seedablerng-for-rngs-with-large-seeds"><a href="#implementing-seedablerng-for-rngs-with-large-seeds">Implementing <code>SeedableRng</code> for RNGs with large seeds</a></h5>
|
|
|
<p>Note that the required traits <code>core::default::Default</code> and
|
|
|
<code>core::convert::AsMut<u8></code> are not implemented for large arrays
|
|
|
<code>[u8; N]</code> with <code>N</code> > 32. To be able to implement the traits required by
|
|
|
<code>SeedableRng</code> for RNGs with such large seeds, the newtype pattern can be
|
|
|
used:</p>
|
|
|
|
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">rand_core::SeedableRng</span>;
|
|
|
|
|
|
<span class="kw">const</span> <span class="ident">N</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">64</span>;
|
|
|
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">MyRngSeed</span>(<span class="kw">pub</span> [<span class="ident">u8</span>; <span class="ident">N</span>]);
|
|
|
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">MyRng</span>(<span class="ident">MyRngSeed</span>);
|
|
|
|
|
|
<span class="kw">impl</span> <span class="ident">Default</span> <span class="kw">for</span> <span class="ident">MyRngSeed</span> {
|
|
|
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="ident">MyRngSeed</span> {
|
|
|
<span class="ident">MyRngSeed</span>([<span class="number">0</span>; <span class="ident">N</span>])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
<span class="kw">impl</span> <span class="ident">AsMut</span><span class="op"><</span>[<span class="ident">u8</span>]<span class="op">></span> <span class="kw">for</span> <span class="ident">MyRngSeed</span> {
|
|
|
<span class="kw">fn</span> <span class="ident">as_mut</span>(<span class="kw-2">&mut</span> <span class="self">self</span>) -> <span class="kw-2">&mut</span> [<span class="ident">u8</span>] {
|
|
|
<span class="kw-2">&mut</span> <span class="self">self</span>.<span class="number">0</span>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
<span class="kw">impl</span> <span class="ident">SeedableRng</span> <span class="kw">for</span> <span class="ident">MyRng</span> {
|
|
|
<span class="kw">type</span> <span class="ident">Seed</span> <span class="op">=</span> <span class="ident">MyRngSeed</span>;
|
|
|
|
|
|
<span class="kw">fn</span> <span class="ident">from_seed</span>(<span class="ident">seed</span>: <span class="ident">MyRngSeed</span>) -> <span class="ident">MyRng</span> {
|
|
|
<span class="ident">MyRng</span>(<span class="ident">seed</span>)
|
|
|
}
|
|
|
}</code></pre></div>
|
|
|
</div></details></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.from_seed" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/rand_core/lib.rs.html#290">source</a></div><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: Self::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> Self</h4></div></summary><div class="docblock"><p>Create a new PRNG using the given seed.</p>
|
|
|
<p>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
|
|
|
<code>seed_from_u64</code> instead.</p>
|
|
|
<p>All PRNG implementations should be reproducible unless otherwise noted:
|
|
|
given a fixed <code>seed</code>, 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.</p>
|
|
|
<p>It is 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.</p>
|
|
|
<p>PRNG implementations should make sure <code>from_seed</code> never panics. In the
|
|
|
case that some special values (like an all zero seed) are not viable
|
|
|
seeds it is preferable to map these to alternative constant value(s),
|
|
|
for example <code>0xBAD5EEDu32</code> or <code>0x0DDB1A5E5BAD5EEDu64</code> (“odd biases? bad
|
|
|
seed”). This is assuming only a small number of values must be rejected.</p>
|
|
|
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="method.seed_from_u64" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/rand_core/lib.rs.html#306">source</a></div><h4 class="code-header">fn <a href="#method.seed_from_u64" class="fnname">seed_from_u64</a>(state: <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u64.html">u64</a>) -> Self</h4></div></summary><div class="docblock"><p>Create a new PRNG using a <code>u64</code> seed.</p>
|
|
|
<p>This is a convenience-wrapper around <code>from_seed</code> to allow construction
|
|
|
of any <code>SeedableRng</code> from a simple <code>u64</code> value. It is designed such that
|
|
|
low Hamming Weight numbers like 0 and 1 can be used and should still
|
|
|
result in good, independent seeds to the PRNG which is returned.</p>
|
|
|
<p>This <strong>is not suitable for cryptography</strong>, as should be clear given that
|
|
|
the input size is only 64 bits.</p>
|
|
|
<p>Implementations for PRNGs <em>may</em> provide their own implementations of
|
|
|
this function, but the default implementation should be good enough for
|
|
|
all purposes. <em>Changing</em> the implementation of this function should be
|
|
|
considered a value-breaking change.</p>
|
|
|
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_rng" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/rand_core/lib.rs.html#361">source</a></div><h4 class="code-header">fn <a href="#method.from_rng" class="fnname">from_rng</a><R>(rng: R) -> <a class="enum" href="https://doc.rust-lang.org/1.62.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, <a class="struct" href="struct.Error.html" title="struct rand::Error">Error</a>> <span class="where fmt-newline">where<br> R: <a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a>, </span></h4></div></summary><div class="docblock"><p>Create a new PRNG seeded from another <code>Rng</code>.</p>
|
|
|
<p>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.</p>
|
|
|
<p>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
|
|
|
<code>from_seed</code>.</p>
|
|
|
<p>Note that seeding <code>XorShiftRng</code> from another <code>XorShiftRng</code> provides an
|
|
|
extreme example of what can go wrong: the new PRNG will be a clone
|
|
|
of the parent.</p>
|
|
|
<p>PRNG implementations are allowed to assume that a good RNG is provided
|
|
|
for seeding, and that it is cryptographically secure when appropriate.
|
|
|
As of <code>rand</code> 0.7 / <code>rand_core</code> 0.5, implementations overriding this
|
|
|
method should ensure the implementation satisfies reproducibility
|
|
|
(in prior versions this was not required).</p>
|
|
|
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_entropy" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/rand_core/lib.rs.html#383">source</a></div><h4 class="code-header">fn <a href="#method.from_entropy" class="fnname">from_entropy</a>() -> Self</h4></div></summary><div class="docblock"><p>Creates a new instance of the RNG seeded via <a href="https://docs.rs/getrandom"><code>getrandom</code></a>.</p>
|
|
|
<p>This method is the recommended way to construct non-deterministic PRNGs
|
|
|
since it is convenient and secure.</p>
|
|
|
<p>In case the overhead of using <a href="https://docs.rs/getrandom"><code>getrandom</code></a> to seed <em>many</em> PRNGs is an
|
|
|
issue, one may prefer to seed from a local PRNG, e.g.
|
|
|
<code>from_rng(thread_rng()).unwrap()</code>.</p>
|
|
|
<h5 id="panics"><a href="#panics">Panics</a></h5>
|
|
|
<p>If <a href="https://docs.rs/getrandom"><code>getrandom</code></a> is unable to provide secure entropy this method will panic.</p>
|
|
|
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-BlockRng64%3CR%3E" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#418-435">source</a></span><a href="#impl-SeedableRng-for-BlockRng64%3CR%3E" class="anchor"></a><h3 class="code-header in-band">impl<R> <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_core/block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a><R> <span class="where fmt-newline">where<br> R: <a class="trait" href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>, </span></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <R as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a></h4></section><section id="method.from_seed" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#422">source</a></span><a href="#method.from_seed" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_core/block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a><R> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_core/block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a><R></h4></section><section id="method.seed_from_u64-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#427">source</a></span><a href="#method.seed_from_u64-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.seed_from_u64" class="fnname">seed_from_u64</a>(seed: <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u64.html">u64</a>) -> <a class="struct" href="../rand_core/block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a><R></h4></section><section id="method.from_rng-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#432">source</a></span><a href="#method.from_rng-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.from_rng" class="fnname">from_rng</a><S>(rng: S) -> <a class="enum" href="https://doc.rust-lang.org/1.62.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../rand_core/block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a><R>, <a class="struct" href="struct.Error.html" title="struct rand::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a>, </span></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-BlockRng%3CR%3E" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#243-260">source</a></span><a href="#impl-SeedableRng-for-BlockRng%3CR%3E" class="anchor"></a><h3 class="code-header in-band">impl<R> <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R> <span class="where fmt-newline">where<br> R: <a class="trait" href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>, </span></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <R as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a></h4></section><section id="method.from_seed-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#247">source</a></span><a href="#method.from_seed-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R></h4></section><section id="method.seed_from_u64-2" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#252">source</a></span><a href="#method.seed_from_u64-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.seed_from_u64" class="fnname">seed_from_u64</a>(seed: <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u64.html">u64</a>) -> <a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R></h4></section><section id="method.from_rng-2" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_core/block.rs.html#257">source</a></span><a href="#method.from_rng-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.from_rng" class="fnname">from_rng</a><S>(rng: S) -> <a class="enum" href="https://doc.rust-lang.org/1.62.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../rand_core/block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a><R>, <a class="struct" href="struct.Error.html" title="struct rand::Error">Error</a>> <span class="where fmt-newline">where<br> S: <a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a>, </span></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha12Rng" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#344">source</a></span><a href="#impl-SeedableRng-for-ChaCha12Rng" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Rng.html" title="struct rand_chacha::chacha::ChaCha12Rng">ChaCha12Rng</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-3" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-2" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#344">source</a></span><a href="#method.from_seed-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Rng.html" title="struct rand_chacha::chacha::ChaCha12Rng">ChaCha12Rng</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Rng.html" title="struct rand_chacha::chacha::ChaCha12Rng">ChaCha12Rng</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha8Rng" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#345">source</a></span><a href="#impl-SeedableRng-for-ChaCha8Rng" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Rng.html" title="struct rand_chacha::chacha::ChaCha8Rng">ChaCha8Rng</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-4" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-4" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-3" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#345">source</a></span><a href="#method.from_seed-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Rng.html" title="struct rand_chacha::chacha::ChaCha8Rng">ChaCha8Rng</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Rng.html" title="struct rand_chacha::chacha::ChaCha8Rng">ChaCha8Rng</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha12Core" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#344">source</a></span><a href="#impl-SeedableRng-for-ChaCha12Core" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Core.html" title="struct rand_chacha::chacha::ChaCha12Core">ChaCha12Core</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-5" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-5" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-4" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#344">source</a></span><a href="#method.from_seed-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Core.html" title="struct rand_chacha::chacha::ChaCha12Core">ChaCha12Core</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Core.html" title="struct rand_chacha::chacha::ChaCha12Core">ChaCha12Core</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha20Core" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#343">source</a></span><a href="#impl-SeedableRng-for-ChaCha20Core" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Core.html" title="struct rand_chacha::chacha::ChaCha20Core">ChaCha20Core</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-6" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-6" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-5" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#343">source</a></span><a href="#method.from_seed-5" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Core.html" title="struct rand_chacha::chacha::ChaCha20Core">ChaCha20Core</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Core.html" title="struct rand_chacha::chacha::ChaCha20Core">ChaCha20Core</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha20Rng" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#343">source</a></span><a href="#impl-SeedableRng-for-ChaCha20Rng" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Rng.html" title="struct rand_chacha::chacha::ChaCha20Rng">ChaCha20Rng</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-7" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-7" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-6" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#343">source</a></span><a href="#method.from_seed-6" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Rng.html" title="struct rand_chacha::chacha::ChaCha20Rng">ChaCha20Rng</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha20Rng.html" title="struct rand_chacha::chacha::ChaCha20Rng">ChaCha20Rng</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-ChaCha8Core" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#345">source</a></span><a href="#impl-SeedableRng-for-ChaCha8Core" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Core.html" title="struct rand_chacha::chacha::ChaCha8Core">ChaCha8Core</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-8" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-8" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.62.1/std/primitive.array.html">; 32]</a></h4></section><section id="method.from_seed-7" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand_chacha/chacha.rs.html#345">source</a></span><a href="#method.from_seed-7" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fnname">from_seed</a>(seed: <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Core.html" title="struct rand_chacha::chacha::ChaCha8Core">ChaCha8Core</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a>) -> <a class="struct" href="../rand_chacha/chacha/struct.ChaCha8Core.html" title="struct rand_chacha::chacha::ChaCha8Core">ChaCha8Core</a></h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-SeedableRng" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/rand/rngs/std.rs.html#58-70">source</a></span><a href="#impl-SeedableRng" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a> for <a class="struct" href="rngs/struct.StdRng.html" title="struct rand::rngs::StdRng">StdRng</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-9" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Seed-9" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = <<a class="struct" href="../rand_chacha/chacha/struct.ChaCha12Rng.html" title="struct rand_chacha::chacha::ChaCha12Rng">ChaCha12Rng</a> as <a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">SeedableRng</a>>::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand::SeedableRng::Seed">Seed</a></h4></section></div></details></div><script type="text/javascript" src="../implementors/rand_core/trait.SeedableRng.js" data-ignore-extern-crates="rand_core,rand_chacha" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="rand" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.62.1 (e092d0b6b 2022-07-16)" ></div>
|
|
|
</body></html> |