Adding large folders

This commit is contained in:
2026-02-26 12:00:21 -05:00
parent 5400d82acd
commit 49701c85ad
47332 changed files with 1942573 additions and 0 deletions

View File

@@ -0,0 +1 @@
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">All</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>List of all items</h1><rustdoc-toolbar></rustdoc-toolbar></div><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.OsError.html">OsError</a></li><li><a href="struct.OsRng.html">OsRng</a></li><li><a href="struct.RngReadAdapter.html">RngReadAdapter</a></li><li><a href="struct.UnwrapErr.html">UnwrapErr</a></li><li><a href="struct.UnwrapMut.html">UnwrapMut</a></li><li><a href="block/struct.BlockRng.html">block::BlockRng</a></li><li><a href="block/struct.BlockRng64.html">block::BlockRng64</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.CryptoRng.html">CryptoRng</a></li><li><a href="trait.RngCore.html">RngCore</a></li><li><a href="trait.SeedableRng.html">SeedableRng</a></li><li><a href="trait.TryCryptoRng.html">TryCryptoRng</a></li><li><a href="trait.TryRngCore.html">TryRngCore</a></li><li><a href="block/trait.BlockRngCore.html">block::BlockRngCore</a></li><li><a href="block/trait.CryptoBlockRng.html">block::CryptoBlockRng</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="impls/fn.fill_bytes_via_next.html">impls::fill_bytes_via_next</a></li><li><a href="impls/fn.fill_via_u32_chunks.html">impls::fill_via_u32_chunks</a></li><li><a href="impls/fn.fill_via_u64_chunks.html">impls::fill_via_u64_chunks</a></li><li><a href="impls/fn.next_u32_via_fill.html">impls::next_u32_via_fill</a></li><li><a href="impls/fn.next_u64_via_fill.html">impls::next_u64_via_fill</a></li><li><a href="impls/fn.next_u64_via_u32.html">impls::next_u64_via_u32</a></li><li><a href="le/fn.read_u32_into.html">le::read_u32_into</a></li><li><a href="le/fn.read_u64_into.html">le::read_u64_into</a></li></ul></section></div></main></body></html>

View File

@@ -0,0 +1,44 @@
<!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="The `BlockRngCore` trait and implementation helpers"><title>rand_core::block - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module block</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module block</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a></div><h1>Module <span>block</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/block.rs.html#9-534">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <code>BlockRngCore</code> trait and implementation helpers</p>
<p>The <a href="trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a> trait exists to assist in the implementation of RNGs
which generate a block of data in a cache instead of returning generated
values directly.</p>
<p>Usage of this trait is optional, but provides two advantages:
implementations only need to concern themselves with generation of the
block, not the various <a href="../trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> methods (especially <a href="../trait.RngCore.html#tymethod.fill_bytes" title="method rand_core::RngCore::fill_bytes"><code>fill_bytes</code></a>, where
the optimal implementations are not trivial), and this allows
<code>ReseedingRng</code> (see <a href="https://docs.rs/rand"><code>rand</code></a> crate) perform periodic
reseeding with very low overhead.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rand_core::{RngCore, SeedableRng};
<span class="kw">use </span>rand_core::block::{BlockRngCore, BlockRng};
<span class="kw">struct </span>MyRngCore;
<span class="kw">impl </span>BlockRngCore <span class="kw">for </span>MyRngCore {
<span class="kw">type </span>Item = u32;
<span class="kw">type </span>Results = [u32; <span class="number">16</span>];
<span class="kw">fn </span>generate(<span class="kw-2">&amp;mut </span><span class="self">self</span>, results: <span class="kw-2">&amp;mut </span><span class="self">Self</span>::Results) {
<span class="macro">unimplemented!</span>()
}
}
<span class="kw">impl </span>SeedableRng <span class="kw">for </span>MyRngCore {
<span class="kw">type </span>Seed = [u8; <span class="number">32</span>];
<span class="kw">fn </span>from_seed(seed: <span class="self">Self</span>::Seed) -&gt; <span class="self">Self </span>{
<span class="macro">unimplemented!</span>()
}
}
<span class="comment">// optionally, also implement CryptoBlockRng for MyRngCore
// Final RNG.
</span><span class="kw">let </span><span class="kw-2">mut </span>rng = BlockRng::&lt;MyRngCore&gt;::seed_from_u64(<span class="number">0</span>);
<span class="macro">println!</span>(<span class="string">"First value: {}"</span>, rng.next_u32());</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BlockRng.html" title="struct rand_core::block::BlockRng">Block<wbr>Rng</a></dt><dd>A wrapper type implementing <a href="../trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> for some type implementing
<a href="trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a> with <code>u32</code> array buffer; i.e. this can be used to implement
a full RNG from just a <code>generate</code> function.</dd><dt><a class="struct" href="struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">Block<wbr>Rng64</a></dt><dd>A wrapper type implementing <a href="../trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> for some type implementing
<a href="trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a> with <code>u64</code> array buffer; i.e. this can be used to implement
a full RNG from just a <code>generate</code> function.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">Block<wbr>RngCore</a></dt><dd>A trait for RNGs which do not generate random numbers individually, but in
blocks (typically <code>[u32; N]</code>). This technique is commonly used by
cryptographic RNGs to improve performance.</dd><dt><a class="trait" href="trait.CryptoBlockRng.html" title="trait rand_core::block::CryptoBlockRng">Crypto<wbr>Block<wbr>Rng</a></dt><dd>A marker trait used to indicate that an <a href="../trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> implementation is
supposed to be cryptographically secure.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["BlockRng","BlockRng64"],"trait":["BlockRngCore","CryptoBlockRng"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
<!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 trait for RNGs which do not generate random numbers individually, but in blocks (typically `[u32; N]`). This technique is commonly used by cryptographic RNGs to improve performance."><title>BlockRngCore in rand_core::block - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">BlockRngCore</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Block<wbr>RngCore</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Item" title="Item">Item</a></li><li><a href="#associatedtype.Results" title="Results">Results</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.generate" title="generate">generate</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>block</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">block</a></div><h1>Trait <span class="trait">Block<wbr>RngCore</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/block.rs.html#67-77">Source</a> </span></div><pre class="rust item-decl"><code>pub trait BlockRngCore {
type <a href="#associatedtype.Item" class="associatedtype">Item</a>;
type <a href="#associatedtype.Results" class="associatedtype">Results</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Item" title="type rand_core::block::BlockRngCore::Item">Item</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Item" title="type rand_core::block::BlockRngCore::Item">Item</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a>;
// Required method
fn <a href="#tymethod.generate" class="fn">generate</a>(&amp;mut self, results: &amp;mut Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Results" title="type rand_core::block::BlockRngCore::Results">Results</a>);
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait for RNGs which do not generate random numbers individually, but in
blocks (typically <code>[u32; N]</code>). This technique is commonly used by
cryptographic RNGs to improve performance.</p>
<p>See the <a href="index.html" title="mod rand_core::block">module</a> documentation for details.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Item" class="method"><a class="src rightside" href="../../src/rand_core/block.rs.html#69">Source</a><h4 class="code-header">type <a href="#associatedtype.Item" class="associatedtype">Item</a></h4></section></summary><div class="docblock"><p>Results element type, e.g. <code>u32</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Results" class="method"><a class="src rightside" href="../../src/rand_core/block.rs.html#73">Source</a><h4 class="code-header">type <a href="#associatedtype.Results" class="associatedtype">Results</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Item" title="type rand_core::block::BlockRngCore::Item">Item</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Item" title="type rand_core::block::BlockRngCore::Item">Item</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a></h4></section></summary><div class="docblock"><p>Results type. This is the block an RNG implementing <code>BlockRngCore</code>
generates, which will usually be an array like <code>[u32; 16]</code>.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.generate" class="method"><a class="src rightside" href="../../src/rand_core/block.rs.html#76">Source</a><h4 class="code-header">fn <a href="#tymethod.generate" class="fn">generate</a>(&amp;mut self, results: &amp;mut Self::<a class="associatedtype" href="trait.BlockRngCore.html#associatedtype.Results" title="type rand_core::block::BlockRngCore::Results">Results</a>)</h4></section></summary><div class="docblock"><p>Generate a new block of results.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/rand_core/block/trait.BlockRngCore.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,4 @@
<!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 marker trait used to indicate that an `RngCore` implementation is supposed to be cryptographically secure."><title>CryptoBlockRng in rand_core::block - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">CryptoBlockRng</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Crypto<wbr>Block<wbr>Rng</a></h2><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>block</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">block</a></div><h1>Trait <span class="trait">Crypto<wbr>Block<wbr>Rng</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/block.rs.html#83">Source</a> </span></div><pre class="rust item-decl"><code>pub trait CryptoBlockRng: <a class="trait" href="trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A marker trait used to indicate that an <a href="../trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> implementation is
supposed to be cryptographically secure.</p>
<p>See <a href="../trait.CryptoRng.html" title="trait rand_core::CryptoRng"><code>CryptoRng</code></a> docs for more information.</p>
</div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/rand_core/block/trait.CryptoBlockRng.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,6 @@
<!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="Implement `fill_bytes` via `next_u64` and `next_u32`, little-endian order."><title>fill_bytes_via_next in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">fill_bytes_via_next</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">fill_<wbr>bytes_<wbr>via_<wbr>next</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#36-52">Source</a> </span></div><pre class="rust item-decl"><code>pub fn fill_bytes_via_next&lt;R: <a class="trait" href="../trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>, dest: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>fill_bytes</code> via <code>next_u64</code> and <code>next_u32</code>, little-endian order.</p>
<p>The fastest way to fill a slice is usually to work as long as possible with
integers. That is why this method mostly uses <code>next_u64</code>, and only when
there are 4 or less bytes remaining at the end of the slice it uses
<code>next_u32</code> once.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,27 @@
<!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="Implement `fill_bytes` by reading chunks from the output buffer of a block based RNG."><title>fill_via_u32_chunks in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">fill_via_u32_chunks</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">fill_<wbr>via_<wbr>u32_<wbr>chunks</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">fill_<wbr>via_<wbr>u32_<wbr>chunks</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#137-139">Source</a> </span></div><pre class="rust item-decl"><code>pub fn fill_via_u32_chunks(src: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>], dest: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; (<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</code></pre><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.9.3: use BlockRng instead</span></div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>fill_bytes</code> by reading chunks from the output buffer of a block
based RNG.</p>
<p>The return values are <code>(consumed_u32, filled_u8)</code>.</p>
<p><code>src</code> is not modified; it is taken as a <code>&amp;mut</code> reference for backward
compatibility with previous versions that did change it.</p>
<p><code>filled_u8</code> is the number of filled bytes in <code>dest</code>, which may be less than
the length of <code>dest</code>.
<code>consumed_u32</code> is the number of words consumed from <code>src</code>, which is the same
as <code>filled_u8 / 4</code> rounded up.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<p>(from <code>IsaacRng</code>)</p>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested"></a><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>fill_bytes(<span class="kw-2">&amp;mut </span><span class="self">self</span>, dest: <span class="kw-2">&amp;mut </span>[u8]) {
<span class="kw">let </span><span class="kw-2">mut </span>read_len = <span class="number">0</span>;
<span class="kw">while </span>read_len &lt; dest.len() {
<span class="kw">if </span><span class="self">self</span>.index &gt;= <span class="self">self</span>.rsl.len() {
<span class="self">self</span>.isaac();
}
<span class="kw">let </span>(consumed_u32, filled_u8) =
impls::fill_via_u32_chunks(<span class="kw-2">&amp;mut </span><span class="self">self</span>.rsl[<span class="self">self</span>.index..],
<span class="kw-2">&amp;mut </span>dest[read_len..]);
<span class="self">self</span>.index += consumed_u32;
read_len += filled_u8;
}
}</code></pre></div></div></details></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!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="Implement `fill_bytes` by reading chunks from the output buffer of a block based RNG."><title>fill_via_u64_chunks in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">fill_via_u64_chunks</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">fill_<wbr>via_<wbr>u64_<wbr>chunks</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#156-158">Source</a> </span></div><pre class="rust item-decl"><code>pub fn fill_via_u64_chunks(src: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>], dest: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; (<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</code></pre><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.9.3: use BlockRng64 instead</span></div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>fill_bytes</code> by reading chunks from the output buffer of a block
based RNG.</p>
<p>The return values are <code>(consumed_u64, filled_u8)</code>.</p>
<p><code>src</code> is not modified; it is taken as a <code>&amp;mut</code> reference for backward
compatibility with previous versions that did change it.</p>
<p><code>filled_u8</code> is the number of filled bytes in <code>dest</code>, which may be less than
the length of <code>dest</code>.
<code>consumed_u64</code> is the number of words consumed from <code>src</code>, which is the same
as <code>filled_u8 / 8</code> rounded up.</p>
<p>See <code>fill_via_u32_chunks</code> for an example.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,2 @@
<!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="Implement `next_u32` via `fill_bytes`, little-endian order."><title>next_u32_via_fill in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">next_u32_via_fill</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">next_<wbr>u32_<wbr>via_<wbr>fill</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#161-165">Source</a> </span></div><pre class="rust item-decl"><code>pub fn next_u32_via_fill&lt;R: <a class="trait" href="../trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>next_u32</code> via <code>fill_bytes</code>, little-endian order.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,2 @@
<!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="Implement `next_u64` via `fill_bytes`, little-endian order."><title>next_u64_via_fill in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">next_u64_via_fill</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">next_<wbr>u64_<wbr>via_<wbr>fill</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#168-172">Source</a> </span></div><pre class="rust item-decl"><code>pub fn next_u64_via_fill&lt;R: <a class="trait" href="../trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>next_u64</code> via <code>fill_bytes</code>, little-endian order.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,2 @@
<!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="Implement `next_u64` via `next_u32`, little-endian order."><title>next_u64_via_u32 in rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">next_u64_via_u32</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>impls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">impls</a></div><h1>Function <span class="fn">next_<wbr>u64_<wbr>via_<wbr>u32</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#23-28">Source</a> </span></div><pre class="rust item-decl"><code>pub fn next_u64_via_u32&lt;R: <a class="trait" href="../trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implement <code>next_u64</code> via <code>next_u32</code>, little-endian order.</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,11 @@
<!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="Helper functions for implementing `RngCore` functions."><title>rand_core::impls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module impls</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module impls</a></h2><h3><a href="#functions">Module Items</a></h3><ul class="block"><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a></div><h1>Module <span>impls</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/impls.rs.html#9-217">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper functions for implementing <code>RngCore</code> functions.</p>
<p>For cross-platform reproducibility, these functions all use Little Endian:
least-significant part first. For example, <code>next_u64_via_u32</code> takes <code>u32</code>
values <code>x, y</code>, then outputs <code>(y &lt;&lt; 32) | x</code>. To implement <code>next_u32</code>
from <code>next_u64</code> in little-endian order, one should use <code>next_u64() as u32</code>.</p>
<p>Byte-swapping (like the std <code>to_le</code> functions) is only needed to convert
to/from byte sequences, and since its purpose is reproducibility,
non-reproducible sources (e.g. <code>OsRng</code>) need not bother with it.</p>
</div></details><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.fill_bytes_via_next.html" title="fn rand_core::impls::fill_bytes_via_next">fill_<wbr>bytes_<wbr>via_<wbr>next</a></dt><dd>Implement <code>fill_bytes</code> via <code>next_u64</code> and <code>next_u32</code>, little-endian order.</dd><dt><a class="fn" href="fn.fill_via_u32_chunks.html" title="fn rand_core::impls::fill_via_u32_chunks">fill_<wbr>via_<wbr>u32_<wbr>chunks</a><wbr><span class="stab deprecated" title="">Deprecated</span></dt><dd>Implement <code>fill_bytes</code> by reading chunks from the output buffer of a block
based RNG.</dd><dt><a class="fn" href="fn.fill_via_u64_chunks.html" title="fn rand_core::impls::fill_via_u64_chunks">fill_<wbr>via_<wbr>u64_<wbr>chunks</a><wbr><span class="stab deprecated" title="">Deprecated</span></dt><dd>Implement <code>fill_bytes</code> by reading chunks from the output buffer of a block
based RNG.</dd><dt><a class="fn" href="fn.next_u32_via_fill.html" title="fn rand_core::impls::next_u32_via_fill">next_<wbr>u32_<wbr>via_<wbr>fill</a></dt><dd>Implement <code>next_u32</code> via <code>fill_bytes</code>, little-endian order.</dd><dt><a class="fn" href="fn.next_u64_via_fill.html" title="fn rand_core::impls::next_u64_via_fill">next_<wbr>u64_<wbr>via_<wbr>fill</a></dt><dd>Implement <code>next_u64</code> via <code>fill_bytes</code>, little-endian order.</dd><dt><a class="fn" href="fn.next_u64_via_u32.html" title="fn rand_core::impls::next_u64_via_u32">next_<wbr>u64_<wbr>via_<wbr>u32</a></dt><dd>Implement <code>next_u64</code> via <code>next_u32</code>, little-endian order.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["fill_bytes_via_next","fill_via_u32_chunks","fill_via_u64_chunks","next_u32_via_fill","next_u64_via_fill","next_u64_via_u32"]};

View File

@@ -0,0 +1,13 @@
<!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="Random number generation traits"><title>rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate rand_core</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>rand_<wbr>core</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#10-771">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Random number generation traits</p>
<p>This crate is mainly of interest to crates publishing implementations of
<a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a>. Other users are encouraged to use the <a href="https://docs.rs/rand"><code>rand</code></a> crate instead
which re-exports the main traits and error types.</p>
<p><a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> is the core trait implemented by algorithmic pseudo-random number
generators and external random-number sources.</p>
<p><a href="trait.SeedableRng.html" title="trait rand_core::SeedableRng"><code>SeedableRng</code></a> is an extension trait for construction from fixed seeds and
other random number generators.</p>
<p>The <a href="impls/index.html" title="mod rand_core::impls"><code>impls</code></a> and <a href="le/index.html" title="mod rand_core::le"><code>le</code></a> sub-modules include a few small functions to assist
implementation of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a>.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="block/index.html" title="mod rand_core::block">block</a></dt><dd>The <code>BlockRngCore</code> trait and implementation helpers</dd><dt><a class="mod" href="impls/index.html" title="mod rand_core::impls">impls</a></dt><dd>Helper functions for implementing <code>RngCore</code> functions.</dd><dt><a class="mod" href="le/index.html" title="mod rand_core::le">le</a></dt><dd>Little-Endian utilities</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.OsError.html" title="struct rand_core::OsError">OsError</a></dt><dd>Error type of <a href="struct.OsRng.html" title="struct rand_core::OsRng"><code>OsRng</code></a></dd><dt><a class="struct" href="struct.OsRng.html" title="struct rand_core::OsRng">OsRng</a></dt><dd>An interface over the operating-systems random data source</dd><dt><a class="struct" href="struct.RngReadAdapter.html" title="struct rand_core::RngReadAdapter">RngRead<wbr>Adapter</a></dt><dd>Adapter that enables reading through a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>io::Read</code></a> from a <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a>.</dd><dt><a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">Unwrap<wbr>Err</a></dt><dd>Wrapper around <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a> implementation which implements <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a>
by panicking on potential errors.</dd><dt><a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">Unwrap<wbr>Mut</a></dt><dd>Wrapper around <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a> implementation which implements <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a>
by panicking on potential errors.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">Crypto<wbr>Rng</a></dt><dd>A marker trait over <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> for securely unpredictable RNGs</dd><dt><a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a></dt><dd>Implementation-level interface for RNGs</dd><dt><a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">Seedable<wbr>Rng</a></dt><dd>A random number generator that can be explicitly seeded.</dd><dt><a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCrypto<wbr>Rng</a></dt><dd>A marker trait over <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a> for securely unpredictable RNGs</dd><dt><a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRng<wbr>Core</a></dt><dd>A potentially fallible variant of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a></dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1,4 @@
<!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="Reads unsigned 32 bit integers from `src` into `dst`."><title>read_u32_into in rand_core::le - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">read_u32_into</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">read_<wbr>u32_<wbr>into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>le</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">le</a></div><h1>Function <span class="fn">read_<wbr>u32_<wbr>into</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/le.rs.html#21-26">Source</a> </span></div><pre class="rust item-decl"><code>pub fn read_u32_into(src: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>], dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>])</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Reads unsigned 32 bit integers from <code>src</code> into <code>dst</code>.</p>
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
<p>If <code>dst</code> has insufficient space (<code>4*dst.len() &lt; src.len()</code>).</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,4 @@
<!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="Reads unsigned 64 bit integers from `src` into `dst`."><title>read_u64_into in rand_core::le - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">read_u64_into</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">read_<wbr>u64_<wbr>into</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand_<wbr>core::<wbr>le</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a>::<wbr><a href="index.html">le</a></div><h1>Function <span class="fn">read_<wbr>u64_<wbr>into</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/le.rs.html#35-40">Source</a> </span></div><pre class="rust item-decl"><code>pub fn read_u64_into(src: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>], dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>])</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Reads unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</p>
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
<p>If <code>dst</code> has insufficient space (<code>8*dst.len() &lt; src.len()</code>).</p>
</div></details></section></div></main></body></html>

View File

@@ -0,0 +1,4 @@
<!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="Little-Endian utilities"><title>rand_core::le - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module le</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module le</a></h2><h3><a href="#functions">Module Items</a></h3><ul class="block"><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand_core</a></div><h1>Module <span>le</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand_core/le.rs.html#9-64">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Little-Endian utilities</p>
<p>Little-Endian order has been chosen for internal usage; this makes some
useful functions available.</p>
</div></details><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.read_u32_into.html" title="fn rand_core::le::read_u32_into">read_<wbr>u32_<wbr>into</a></dt><dd>Reads unsigned 32 bit integers from <code>src</code> into <code>dst</code>.</dd><dt><a class="fn" href="fn.read_u64_into.html" title="fn rand_core::le::read_u64_into">read_<wbr>u64_<wbr>into</a></dt><dd>Reads unsigned 64 bit integers from <code>src</code> into <code>dst</code>.</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["read_u32_into","read_u64_into"]};

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../rand_core/struct.OsError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../rand_core/struct.OsError.html">../../rand_core/struct.OsError.html</a>...</p>
<script>location.replace("../../rand_core/struct.OsError.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../rand_core/struct.OsRng.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../rand_core/struct.OsRng.html">../../rand_core/struct.OsRng.html</a>...</p>
<script>location.replace("../../rand_core/struct.OsRng.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"mod":["block","impls","le"],"struct":["OsError","OsRng","RngReadAdapter","UnwrapErr","UnwrapMut"],"trait":["CryptoRng","RngCore","SeedableRng","TryCryptoRng","TryRngCore"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
<!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 marker trait over `RngCore` for securely unpredictable RNGs"><title>CryptoRng in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">CryptoRng</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Crypto<wbr>Rng</a></h2><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></div><h1>Trait <span class="trait">Crypto<wbr>Rng</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#204">Source</a> </span></div><pre class="rust item-decl"><code>pub trait CryptoRng: <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A marker trait over <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> for securely unpredictable RNGs</p>
<p>This marker trait indicates that the implementing generator is intended,
when correctly seeded and protected from side-channel attacks such as a
leaking of state, to be a cryptographically secure generator. This trait is
provided as a tool to aid review of cryptographic code, but does not by
itself guarantee suitability for cryptographic applications.</p>
<p>Implementors of <code>CryptoRng</code> automatically implement the <a href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng"><code>TryCryptoRng</code></a>
trait.</p>
<p>Implementors of <code>CryptoRng</code> should only implement <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default"><code>Default</code></a> if the
<code>default()</code> instances are themselves secure generators: for example if the
implementing type is a stateless interface over a secure external generator
(like <a href="struct.OsRng.html" title="struct rand_core::OsRng"><code>OsRng</code></a>) or if the <code>default()</code> instance uses a strong, fresh seed.</p>
<p>Formally, a CSPRNG (Cryptographically Secure Pseudo-Random Number Generator)
should satisfy an additional property over other generators: assuming that
the generator has been appropriately seeded and has unknown state, then
given the first <em>k</em> bits of an algorithms output
sequence, it should not be possible using polynomial-time algorithms to
predict the next bit with probability significantly greater than 50%.</p>
<p>An optional property of CSPRNGs is backtracking resistance: if the CSPRNGs
state is revealed, it will not be computationally-feasible to reconstruct
prior output values. This property is not required by <code>CryptoRng</code>.</p>
</div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-CryptoRng-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#261">Source</a><a href="#impl-CryptoRng-for-BlockRng%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.CryptoBlockRng.html" title="trait rand_core::block::CryptoBlockRng">CryptoBlockRng</a> + <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>&gt;&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-BlockRng64%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#424">Source</a><a href="#impl-CryptoRng-for-BlockRng64%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.CryptoBlockRng.html" title="trait rand_core::block::CryptoBlockRng">CryptoBlockRng</a> + <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>&gt;&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-UnwrapMut%3C'_,+R%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#356">Source</a><a href="#impl-CryptoRng-for-UnwrapMut%3C'_,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">UnwrapMut</a>&lt;'_, R&gt;</h3></section><section id="impl-CryptoRng-for-UnwrapErr%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#317">Source</a><a href="#impl-CryptoRng-for-UnwrapErr%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for <a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">UnwrapErr</a>&lt;R&gt;</h3></section><section id="impl-CryptoRng-for-T" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#206">Source</a><a href="#impl-CryptoRng-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>&gt; <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> for T<div class="where">where
T::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a>,</div></h3></section></div><script src="../trait.impl/rand_core/trait.CryptoRng.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,84 @@
<!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="Implementation-level interface for RNGs"><title>RngCore in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">RngCore</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">RngCore</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.fill_bytes" title="fill_bytes">fill_bytes</a></li><li><a href="#tymethod.next_u32" title="next_u32">next_u32</a></li><li><a href="#tymethod.next_u64" title="next_u64">next_u64</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></div><h1>Trait <span class="trait">RngCore</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#130-156">Source</a> </span></div><pre class="rust item-decl"><code>pub trait RngCore {
// Required methods
fn <a href="#tymethod.next_u32" class="fn">next_u32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.next_u64" class="fn">next_u64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.fill_bytes" class="fn">fill_bytes</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]);
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implementation-level interface for RNGs</p>
<p>This trait encapsulates the low-level functionality common to all
generators, and is the “back end”, to be implemented by generators.
End users should normally use the <a href="https://docs.rs/rand/latest/rand/trait.Rng.html"><code>rand::Rng</code></a> trait
which is automatically implemented for every type implementing <code>RngCore</code>.</p>
<p>Three different methods for generating random data are provided since the
optimal implementation of each is dependent on the type of generator. There
is no required relationship between the output of each; e.g. many
implementations of <a href="trait.RngCore.html#tymethod.fill_bytes" title="method rand_core::RngCore::fill_bytes"><code>fill_bytes</code></a> consume a whole number of <code>u32</code> or <code>u64</code>
values and drop any remaining unused bytes. The same can happen with the
<a href="trait.RngCore.html#tymethod.next_u32" title="method rand_core::RngCore::next_u32"><code>next_u32</code></a> and <a href="trait.RngCore.html#tymethod.next_u64" title="method rand_core::RngCore::next_u64"><code>next_u64</code></a> methods, implementations may discard some
random bits for efficiency.</p>
<p>Implementers should produce bits uniformly. Pathological RNGs (e.g. always
returning the same value, or never setting certain bits) can break rejection
sampling used by random distributions, and also break other RNGs when
seeding them via <a href="trait.SeedableRng.html#method.from_rng" title="associated function rand_core::SeedableRng::from_rng"><code>SeedableRng::from_rng</code></a>.</p>
<p>Algorithmic generators implementing <a href="trait.SeedableRng.html" title="trait rand_core::SeedableRng"><code>SeedableRng</code></a> should normally have
<em>portable, reproducible</em> output, i.e. fix Endianness when converting values
to avoid platform differences, and avoid making any changes which affect
output (except by communicating that the release has breaking changes).</p>
<p>Typically an RNG will implement only one of the methods available
in this trait directly, then use the helper functions from the
<a href="impls/index.html" title="mod rand_core::impls"><code>impls</code></a> module to implement the other methods.</p>
<p>Note that implementors of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> also automatically implement
the <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a> trait with the <code>Error</code> associated type being
equal to <a href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible"><code>Infallible</code></a>.</p>
<p>It is recommended that implementations also implement:</p>
<ul>
<li><code>Debug</code> with a custom implementation which <em>does not</em> print any internal
state (at least, <a href="trait.CryptoRng.html" title="trait rand_core::CryptoRng"><code>CryptoRng</code></a>s should not risk leaking state through
<code>Debug</code>).</li>
<li><code>Serialize</code> and <code>Deserialize</code> (from Serde), preferably making Serde
support optional at the crate level in PRNG libs.</li>
<li><code>Clone</code>, if possible.</li>
<li><em>never</em> implement <code>Copy</code> (accidental copies may cause repeated values).</li>
<li><em>do not</em> implement <code>Default</code> for pseudorandom generators, but instead
implement <a href="trait.SeedableRng.html" title="trait rand_core::SeedableRng"><code>SeedableRng</code></a>, to guide users towards proper seeding.
External / hardware RNGs can choose to implement <code>Default</code>.</li>
<li><code>Eq</code> and <code>PartialEq</code> could be implemented, but are probably not useful.</li>
</ul>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<p>A simple example, obviously not generating very <em>random</em> output:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![allow(dead_code)]
</span><span class="kw">use </span>rand_core::{RngCore, impls};
<span class="kw">struct </span>CountingRng(u64);
<span class="kw">impl </span>RngCore <span class="kw">for </span>CountingRng {
<span class="kw">fn </span>next_u32(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; u32 {
<span class="self">self</span>.next_u64() <span class="kw">as </span>u32
}
<span class="kw">fn </span>next_u64(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; u64 {
<span class="self">self</span>.<span class="number">0 </span>+= <span class="number">1</span>;
<span class="self">self</span>.<span class="number">0
</span>}
<span class="kw">fn </span>fill_bytes(<span class="kw-2">&amp;mut </span><span class="self">self</span>, dst: <span class="kw-2">&amp;mut </span>[u8]) {
impls::fill_bytes_via_next(<span class="self">self</span>, dst)
}
}</code></pre></div></div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.next_u32" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#136">Source</a><h4 class="code-header">fn <a href="#tymethod.next_u32" class="fn">next_u32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Return the next random <code>u32</code>.</p>
<p>RNGs must implement at least one method from this trait directly. In
the case this method is not implemented directly, it can be implemented
using <code>self.next_u64() as u32</code> or via <a href="impls/fn.next_u32_via_fill.html" title="fn rand_core::impls::next_u32_via_fill"><code>impls::next_u32_via_fill</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.next_u64" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#143">Source</a><h4 class="code-header">fn <a href="#tymethod.next_u64" class="fn">next_u64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Return the next random <code>u64</code>.</p>
<p>RNGs must implement at least one method from this trait directly. In
the case this method is not implemented directly, it can be implemented
via <a href="impls/fn.next_u64_via_u32.html" title="fn rand_core::impls::next_u64_via_u32"><code>impls::next_u64_via_u32</code></a> or via <a href="impls/fn.next_u64_via_fill.html" title="fn rand_core::impls::next_u64_via_fill"><code>impls::next_u64_via_fill</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.fill_bytes" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#155">Source</a><h4 class="code-header">fn <a href="#tymethod.fill_bytes" class="fn">fill_bytes</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class="docblock"><p>Fill <code>dest</code> with random data.</p>
<p>RNGs must implement at least one method from this trait directly. In
the case this method is not implemented directly, it can be implemented
via <a href="impls/fn.fill_bytes_via_next.html" title="fn rand_core::impls::fill_bytes_via_next"><code>impls::fill_bytes_via_next</code></a>.</p>
<p>This method should guarantee that <code>dest</code> is entirely filled
with new data, and may panic if this is impossible
(e.g. reading past the end of a file that is being used as the
source of randomness).</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-RngCore-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#184-235">Source</a><a href="#impl-RngCore-for-BlockRng%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>&gt;&gt; <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> for <a class="struct" href="block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a>&lt;R&gt;</h3></section><section id="impl-RngCore-for-BlockRng64%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#348-398">Source</a><a href="#impl-RngCore-for-BlockRng64%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>&gt;&gt; <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> for <a class="struct" href="block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a>&lt;R&gt;</h3></section><section id="impl-RngCore-for-UnwrapMut%3C'_,+R%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#339-354">Source</a><a href="#impl-RngCore-for-UnwrapMut%3C'_,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> for <a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">UnwrapMut</a>&lt;'_, R&gt;</h3></section><section id="impl-RngCore-for-UnwrapErr%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#300-315">Source</a><a href="#impl-RngCore-for-UnwrapErr%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a>&gt; <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> for <a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">UnwrapErr</a>&lt;R&gt;</h3></section><section id="impl-RngCore-for-T" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#158-176">Source</a><a href="#impl-RngCore-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>&gt; <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> for T<div class="where">where
T::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a>,</div></h3></section></div><script src="../trait.impl/rand_core/trait.RngCore.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,131 @@
<!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."><title>SeedableRng in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">SeedableRng</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Seedable<wbr>Rng</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Seed" title="Seed">Seed</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_seed" title="from_seed">from_seed</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.from_os_rng" title="from_os_rng">from_os_rng</a></li><li><a href="#method.from_rng" title="from_rng">from_rng</a></li><li><a href="#method.seed_from_u64" title="seed_from_u64">seed_from_u64</a></li><li><a href="#method.try_from_os_rng" title="try_from_os_rng">try_from_os_rng</a></li><li><a href="#method.try_from_rng" title="try_from_rng">try_from_rng</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></div><h1>Trait <span class="trait">Seedable<wbr>Rng</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#371-577">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SeedableRng: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.Seed" class="associatedtype">Seed</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt;;
// Required method
fn <a href="#tymethod.from_seed" class="fn">from_seed</a>(seed: Self::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand_core::SeedableRng::Seed">Seed</a>) -&gt; Self;
// Provided methods
fn <a href="#method.seed_from_u64" class="fn">seed_from_u64</a>(state: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.from_rng" class="fn">from_rng</a>(rng: &amp;mut impl <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a>) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.try_from_rng" class="fn">try_from_rng</a>&lt;R: <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, R::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.from_os_rng" class="fn">from_os_rng</a>() -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.try_from_os_rng" class="fn">try_from_os_rng</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Error&gt; { ... }
}</code></pre><details class="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>
<p>A generator implementing <code>SeedableRng</code> will usually be deterministic, but
beware that portability and reproducibility of results <strong>is not implied</strong>.
Refer to documentation of the generator, noting that generators named after
a specific algorithm are usually tested for reproducibility against a
reference vector, while <code>SmallRng</code> and <code>StdRng</code> specifically opt out of
reproducibility guarantees.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Seed" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#423">Source</a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]&gt;</h4></section></summary><div class="docblock"><p>Seed type, which is restricted to types mutably-dereferenceable 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 RNGs a seed of 256 bits is recommended, <code>[u8; 32]</code>.</p>
<h5 id="implementing-seedablerng-for-rngs-with-large-seeds"><a class="doc-anchor" href="#implementing-seedablerng-for-rngs-with-large-seeds">§</a>Implementing <code>SeedableRng</code> for RNGs with large seeds</h5>
<p>Note that <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default"><code>Default</code></a> is not implemented for large arrays <code>[u8; N]</code> with
<code>N</code> &gt; 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>rand_core::SeedableRng;
<span class="kw">const </span>N: usize = <span class="number">64</span>;
<span class="attr">#[derive(Clone)]
</span><span class="kw">pub struct </span>MyRngSeed(<span class="kw">pub </span>[u8; N]);
<span class="kw">pub struct </span>MyRng(MyRngSeed);
<span class="kw">impl </span>Default <span class="kw">for </span>MyRngSeed {
<span class="kw">fn </span>default() -&gt; MyRngSeed {
MyRngSeed([<span class="number">0</span>; N])
}
}
<span class="kw">impl </span>AsRef&lt;[u8]&gt; <span class="kw">for </span>MyRngSeed {
<span class="kw">fn </span>as_ref(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw-2">&amp;</span>[u8] {
<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0
</span>}
}
<span class="kw">impl </span>AsMut&lt;[u8]&gt; <span class="kw">for </span>MyRngSeed {
<span class="kw">fn </span>as_mut(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="kw-2">&amp;mut </span>[u8] {
<span class="kw-2">&amp;mut </span><span class="self">self</span>.<span class="number">0
</span>}
}
<span class="kw">impl </span>SeedableRng <span class="kw">for </span>MyRng {
<span class="kw">type </span>Seed = MyRngSeed;
<span class="kw">fn </span>from_seed(seed: MyRngSeed) -&gt; MyRng {
MyRng(seed)
}
}</code></pre></div></div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.from_seed" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#450">Source</a><h4 class="code-header">fn <a href="#tymethod.from_seed" class="fn">from_seed</a>(seed: Self::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand_core::SeedableRng::Seed">Seed</a>) -&gt; Self</h4></section></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="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.seed_from_u64" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#466-495">Source</a><h4 class="code-header">fn <a href="#method.seed_from_u64" class="fn">seed_from_u64</a>(state: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -&gt; Self</h4></section></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="toggle method-toggle" open><summary><section id="method.from_rng" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#521-525">Source</a><h4 class="code-header">fn <a href="#method.from_rng" class="fn">from_rng</a>(rng: &amp;mut impl <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new PRNG seeded from an infallible <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="toggle method-toggle" open><summary><section id="method.try_from_rng" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#530-534">Source</a><h4 class="code-header">fn <a href="#method.try_from_rng" class="fn">try_from_rng</a>&lt;R: <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a>&gt;(rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, R::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Create a new PRNG seeded from a potentially fallible <code>Rng</code>.</p>
<p>See <a href="trait.SeedableRng.html#method.from_rng" title="associated function rand_core::SeedableRng::from_rng"><code>from_rng</code></a> docs for more information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_os_rng" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#555-560">Source</a><h4 class="code-header">fn <a href="#method.from_os_rng" class="fn">from_os_rng</a>() -&gt; Self</h4></section></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>Note that this method may panic on (extremely unlikely) <a href="https://docs.rs/getrandom"><code>getrandom</code></a> errors.
If its not desirable, use the <a href="trait.SeedableRng.html#method.try_from_os_rng" title="associated function rand_core::SeedableRng::try_from_os_rng"><code>try_from_os_rng</code></a> method instead.</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(rand::rng()).unwrap()</code>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</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><details class="toggle method-toggle" open><summary><section id="method.try_from_os_rng" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#571-576">Source</a><h4 class="code-header">fn <a href="#method.try_from_os_rng" class="fn">try_from_os_rng</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Error&gt;</h4></section></summary><div class="docblock"><p>Creates a new instance of the RNG seeded via <a href="https://docs.rs/getrandom"><code>getrandom</code></a> without unwrapping
potential <a href="https://docs.rs/getrandom"><code>getrandom</code></a> errors.</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(&amp;mut rand::rng()).unwrap()</code>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-BlockRng64%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#400-422">Source</a><a href="#impl-SeedableRng-for-BlockRng64%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a>&gt; <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a> for <a class="struct" href="block/struct.BlockRng64.html" title="struct rand_core::block::BlockRng64">BlockRng64</a>&lt;R&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/rand_core/block.rs.html#401">Source</a><a href="#associatedtype.Seed-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = &lt;R as <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a>&gt;::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand_core::SeedableRng::Seed">Seed</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-SeedableRng-for-BlockRng%3CR%3E" class="impl"><a class="src rightside" href="../src/rand_core/block.rs.html#237-259">Source</a><a href="#impl-SeedableRng-for-BlockRng%3CR%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore">BlockRngCore</a> + <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a>&gt; <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a> for <a class="struct" href="block/struct.BlockRng.html" title="struct rand_core::block::BlockRng">BlockRng</a>&lt;R&gt;</h3></section></summary><div class="impl-items"><section id="associatedtype.Seed-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/rand_core/block.rs.html#238">Source</a><a href="#associatedtype.Seed-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Seed" class="associatedtype">Seed</a> = &lt;R as <a class="trait" href="trait.SeedableRng.html" title="trait rand_core::SeedableRng">SeedableRng</a>&gt;::<a class="associatedtype" href="trait.SeedableRng.html#associatedtype.Seed" title="type rand_core::SeedableRng::Seed">Seed</a></h4></section></div></details></div><script src="../trait.impl/rand_core/trait.SeedableRng.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,12 @@
<!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 marker trait over `TryRngCore` for securely unpredictable RNGs"><title>TryCryptoRng in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">TryCryptoRng</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">TryCrypto<wbr>Rng</a></h2><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></div><h1>Trait <span class="trait">TryCrypto<wbr>Rng</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#291">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryCryptoRng: <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A marker trait over <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a> for securely unpredictable RNGs</p>
<p>This trait is like <a href="trait.CryptoRng.html" title="trait rand_core::CryptoRng"><code>CryptoRng</code></a> but for the trait <a href="trait.TryRngCore.html" title="trait rand_core::TryRngCore"><code>TryRngCore</code></a>.</p>
<p>This marker trait indicates that the implementing generator is intended,
when correctly seeded and protected from side-channel attacks such as a
leaking of state, to be a cryptographically secure generator. This trait is
provided as a tool to aid review of cryptographic code, but does not by
itself guarantee suitability for cryptographic applications.</p>
<p>Implementors of <code>TryCryptoRng</code> should only implement <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default"><code>Default</code></a> if the
<code>default()</code> instances are themselves secure generators: for example if the
implementing type is a stateless interface over a secure external generator
(like <a href="struct.OsRng.html" title="struct rand_core::OsRng"><code>OsRng</code></a>) or if the <code>default()</code> instance uses a strong, fresh seed.</p>
</div></details><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-TryCryptoRng-for-OsRng" class="impl"><a class="src rightside" href="../src/rand_core/os.rs.html#102">Source</a><a href="#impl-TryCryptoRng-for-OsRng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a> for <a class="struct" href="struct.OsRng.html" title="struct rand_core::OsRng">OsRng</a></h3></section><section id="impl-TryCryptoRng-for-R" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#293">Source</a><a href="#impl-TryCryptoRng-for-R" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.CryptoRng.html" title="trait rand_core::CryptoRng">CryptoRng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.TryCryptoRng.html" title="trait rand_core::TryCryptoRng">TryCryptoRng</a> for R</h3></section></div><script src="../trait.impl/rand_core/trait.TryCryptoRng.js" async></script></section></div></main></body></html>

View File

@@ -0,0 +1,33 @@
<!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 potentially fallible variant of `RngCore`"><title>TryRngCore in rand_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.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]--><rustdoc-topbar><h2><a href="#">TryRngCore</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand_core/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand_core/index.html">rand_<wbr>core</a><span class="version">0.9.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">TryRng<wbr>Core</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.try_fill_bytes" title="try_fill_bytes">try_fill_bytes</a></li><li><a href="#tymethod.try_next_u32" title="try_next_u32">try_next_u32</a></li><li><a href="#tymethod.try_next_u64" title="try_next_u64">try_next_u64</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.read_adapter" title="read_adapter">read_adapter</a></li><li><a href="#method.unwrap_err" title="unwrap_err">unwrap_err</a></li><li><a href="#method.unwrap_mut" title="unwrap_mut">unwrap_mut</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate rand_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">rand_core</a></div><h1>Trait <span class="trait">TryRng<wbr>Core</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rand_core/lib.rs.html#220-252">Source</a> </span></div><pre class="rust item-decl"><code>pub trait TryRngCore {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>;
// Required methods
fn <a href="#tymethod.try_next_u32" class="fn">try_next_u32</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.try_next_u64" class="fn">try_next_u64</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.try_fill_bytes" class="fn">try_fill_bytes</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;;
// Provided methods
fn <a href="#method.unwrap_err" class="fn">unwrap_err</a>(self) -&gt; <a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">UnwrapErr</a>&lt;Self&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.unwrap_mut" class="fn">unwrap_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">UnwrapMut</a>&lt;'_, Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.read_adapter" class="fn">read_adapter</a>(&amp;mut self) -&gt; <a class="struct" href="struct.RngReadAdapter.html" title="struct rand_core::RngReadAdapter">RngReadAdapter</a>&lt;'_, Self&gt; <a href="#" class="tooltip" data-notable-ty="RngReadAdapter&lt;&#39;_, Self&gt;"></a>
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A potentially fallible variant of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a></p>
<p>This trait is a generalization of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> to support potentially-
fallible IO-based generators such as <a href="struct.OsRng.html" title="struct rand_core::OsRng"><code>OsRng</code></a>.</p>
<p>All implementations of <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> automatically support this <code>TryRngCore</code>
trait, using <a href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible"><code>Infallible</code></a> as the associated
<code>Error</code> type.</p>
<p>An implementation of this trait may be made compatible with code requiring
an <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> through <a href="trait.TryRngCore.html#method.unwrap_err" title="method rand_core::TryRngCore::unwrap_err"><code>TryRngCore::unwrap_err</code></a>. The resulting RNG will
panic in case the underlying fallible RNG yields an error.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#222">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a></h4></section></summary><div class="docblock"><p>The type returned in the event of a RNG error.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.try_next_u32" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#225">Source</a><h4 class="code-header">fn <a href="#tymethod.try_next_u32" class="fn">try_next_u32</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Return the next random <code>u32</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.try_next_u64" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#227">Source</a><h4 class="code-header">fn <a href="#tymethod.try_next_u64" class="fn">try_next_u64</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Return the next random <code>u64</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.try_fill_bytes" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#229">Source</a><h4 class="code-header">fn <a href="#tymethod.try_fill_bytes" class="fn">try_fill_bytes</a>(&amp;mut self, dst: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.TryRngCore.html#associatedtype.Error" title="type rand_core::TryRngCore::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Fill <code>dest</code> entirely with random data.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.unwrap_err" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#232-237">Source</a><h4 class="code-header">fn <a href="#method.unwrap_err" class="fn">unwrap_err</a>(self) -&gt; <a class="struct" href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr">UnwrapErr</a>&lt;Self&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Wrap RNG with the <a href="struct.UnwrapErr.html" title="struct rand_core::UnwrapErr"><code>UnwrapErr</code></a> wrapper.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unwrap_mut" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#240-242">Source</a><h4 class="code-header">fn <a href="#method.unwrap_mut" class="fn">unwrap_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut">UnwrapMut</a>&lt;'_, Self&gt;</h4></section></summary><div class="docblock"><p>Wrap RNG with the <a href="struct.UnwrapMut.html" title="struct rand_core::UnwrapMut"><code>UnwrapMut</code></a> wrapper.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_adapter" class="method"><a class="src rightside" href="../src/rand_core/lib.rs.html#246-251">Source</a><h4 class="code-header">fn <a href="#method.read_adapter" class="fn">read_adapter</a>(&amp;mut self) -&gt; <a class="struct" href="struct.RngReadAdapter.html" title="struct rand_core::RngReadAdapter">RngReadAdapter</a>&lt;'_, Self&gt; <a href="#" class="tooltip" data-notable-ty="RngReadAdapter&lt;&#39;_, Self&gt;"></a><div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Convert an <a href="trait.RngCore.html" title="trait rand_core::RngCore"><code>RngCore</code></a> to a <a href="struct.RngReadAdapter.html" title="struct rand_core::RngReadAdapter"><code>RngReadAdapter</code></a>.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-TryRngCore-for-OsRng" class="impl"><a class="src rightside" href="../src/rand_core/os.rs.html#83-100">Source</a><a href="#impl-TryRngCore-for-OsRng" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a> for <a class="struct" href="struct.OsRng.html" title="struct rand_core::OsRng">OsRng</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/rand_core/os.rs.html#84">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="struct.OsError.html" title="struct rand_core::OsError">OsError</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryRngCore-for-R" class="impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#257-275">Source</a><a href="#impl-TryRngCore-for-R" class="anchor">§</a><h3 class="code-header">impl&lt;R: <a class="trait" href="trait.RngCore.html" title="trait rand_core::RngCore">RngCore</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="trait.TryRngCore.html" title="trait rand_core::TryRngCore">TryRngCore</a> for R</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/rand_core/lib.rs.html#258">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></div></details></div><script src="../trait.impl/rand_core/trait.TryRngCore.js" async></script><script type="text/json" id="notable-traits-data">{"RngReadAdapter<'_, Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.RngReadAdapter.html\" title=\"struct rand_core::RngReadAdapter\">RngReadAdapter</a>&lt;'_, R&gt;</code></h3><pre><code><div class=\"where\">impl&lt;R: <a class=\"trait\" href=\"trait.TryRngCore.html\" title=\"trait rand_core::TryRngCore\">TryRngCore</a> + ?<a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html\" title=\"trait core::marker::Sized\">Sized</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"struct.RngReadAdapter.html\" title=\"struct rand_core::RngReadAdapter\">RngReadAdapter</a>&lt;'_, R&gt;</div>"}</script></section></div></main></body></html>