rusty_snek_gaem/target/doc/rand/rngs/struct.JitterRng.html
2018-10-28 21:14:05 -05:00

144 lines
30 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="API documentation for the Rust `JitterRng` struct in crate `rand`."><meta name="keywords" content="rust, rustlang, rust-lang, JitterRng"><title>rand::rngs::JitterRng - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><link rel="shortcut icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../rand/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk.png' alt='logo' width='100'></a><p class='location'>Struct JitterRng</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.new_with_timer">new_with_timer</a><a href="#method.set_rounds">set_rounds</a><a href="#method.test_timer">test_timer</a><a href="#method.timer_stats">timer_stats</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Clone">Clone</a><a href="#impl-RngCore">RngCore</a><a href="#impl-CryptoRng">CryptoRng</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div></div><p class='location'><a href='../index.html'>rand</a>::<wbr><a href='index.html'>rngs</a></p><script>window.sidebarCurrent = {name: 'JitterRng', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press S to search, ? for more options…" type="search"><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>rand</a>::<wbr><a href='index.html'>rngs</a>::<wbr><a class="struct" href=''>JitterRng</a></span><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#138-148' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct JitterRng { /* fields omitted */ }</pre></div><div class='docblock'><p>A true random number generator based on jitter in the CPU execution time,
and jitter in memory access time.</p>
<p>This is a true random number generator, as opposed to pseudo-random
generators. Random numbers generated by <code>JitterRng</code> can be seen as fresh
entropy. A consequence is that is orders of magnitude slower than <a href="struct.OsRng.html"><code>OsRng</code></a>
and PRNGs (about 10<sup>3</sup>..10<sup>6</sup> slower).</p>
<p>There are very few situations where using this RNG is appropriate. Only very
few applications require true entropy. A normal PRNG can be statistically
indistinguishable, and a cryptographic PRNG should also be as impossible to
predict.</p>
<p>Use of <code>JitterRng</code> is recommended for initializing cryptographic PRNGs when
<a href="struct.OsRng.html"><code>OsRng</code></a> is not available.</p>
<p><code>JitterRng</code> can be used without the standard library, but not conveniently,
you must provide a high-precision timer and carefully have to follow the
instructions of <a href="struct.JitterRng.html#method.new_with_timer"><code>new_with_timer</code></a>.</p>
<p>This implementation is based on
<a href="http://www.chronox.de/jent.html">Jitterentropy</a> version 2.1.0.</p>
<p>Note: There is no accurate timer available on Wasm platforms, to help
prevent fingerprinting or timing side-channel attacks. Therefore
<a href="struct.JitterRng.html#method.new"><code>JitterRng::new()</code></a> is not available on Wasm.</p>
<h1 id="quality-testing" class="section-header"><a href="#quality-testing">Quality testing</a></h1>
<p><a href="struct.JitterRng.html#method.new"><code>JitterRng::new()</code></a> has build-in, but limited, quality testing, however
before using <code>JitterRng</code> on untested hardware, or after changes that could
effect how the code is optimized (such as a new LLVM version), it is
recommend to run the much more stringent
<a href="https://github.com/usnistgov/SP800-90B_EntropyAssessment">NIST SP 800-90B Entropy Estimation Suite</a>.</p>
<p>Use the following code using <a href="struct.JitterRng.html#method.timer_stats"><code>timer_stats</code></a> to collect the data:</p>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rand</span>::<span class="ident">jitter</span>::<span class="ident">JitterRng</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rng</span> <span class="op">=</span> <span class="ident">JitterRng</span>::<span class="ident">new</span>()<span class="question-mark">?</span>;
<span class="comment">// 1_000_000 results are required for the</span>
<span class="comment">// NIST SP 800-90B Entropy Estimation Suite</span>
<span class="kw">const</span> <span class="ident">ROUNDS</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">1_000_000</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">deltas_variable</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">with_capacity</span>(<span class="ident">ROUNDS</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">deltas_minimal</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">Vec</span>::<span class="ident">with_capacity</span>(<span class="ident">ROUNDS</span>);
<span class="kw">for</span> <span class="kw">_</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">ROUNDS</span> {
<span class="ident">deltas_variable</span>.<span class="ident">push</span>(<span class="ident">rng</span>.<span class="ident">timer_stats</span>(<span class="bool-val">true</span>) <span class="kw">as</span> <span class="ident">u8</span>);
<span class="ident">deltas_minimal</span>.<span class="ident">push</span>(<span class="ident">rng</span>.<span class="ident">timer_stats</span>(<span class="bool-val">false</span>) <span class="kw">as</span> <span class="ident">u8</span>);
}
<span class="comment">// Write out after the statistics collection loop, to not disturb the</span>
<span class="comment">// test results.</span>
<span class="ident">File</span>::<span class="ident">create</span>(<span class="string">&quot;jitter_rng_var.bin&quot;</span>)<span class="question-mark">?</span>.<span class="ident">write</span>(<span class="kw-2">&amp;</span><span class="ident">deltas_variable</span>)<span class="question-mark">?</span>;
<span class="ident">File</span>::<span class="ident">create</span>(<span class="string">&quot;jitter_rng_min.bin&quot;</span>)<span class="question-mark">?</span>.<span class="ident">write</span>(<span class="kw-2">&amp;</span><span class="ident">deltas_minimal</span>)<span class="question-mark">?</span>;</pre>
<p>This will produce two files: <code>jitter_rng_var.bin</code> and <code>jitter_rng_min.bin</code>.
Run the Entropy Estimation Suite in three configurations, as outlined below.
Every run has two steps. One step to produce an estimation, another to
validate the estimation.</p>
<ol>
<li>Estimate the expected amount of entropy that is at least available with
each round of the entropy collector. This number should be greater than
the amount estimated with <code>64 / test_timer()</code>.
<pre><code class="language-sh">python noniid_main.py -v jitter_rng_var.bin 8
restart.py -v jitter_rng_var.bin 8 &lt;min-entropy&gt;
</code></pre>
</li>
<li>Estimate the expected amount of entropy that is available in the last 4
bits of the timer delta after running noice sources. Note that a value of
<code>3.70</code> is the minimum estimated entropy for true randomness.
<pre><code class="language-sh">python noniid_main.py -v -u 4 jitter_rng_var.bin 4
restart.py -v -u 4 jitter_rng_var.bin 4 &lt;min-entropy&gt;
</code></pre>
</li>
<li>Estimate the expected amount of entropy that is available to the entropy
collector if both noice sources only run their minimal number of times.
This measures the absolute worst-case, and gives a lower bound for the
available entropy.
<pre><code class="language-sh">python noniid_main.py -v -u 4 jitter_rng_min.bin 4
restart.py -v -u 4 jitter_rng_min.bin 4 &lt;min-entropy&gt;
</code></pre>
</li>
</ol>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#278-774' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a>, <a class="enum" href="../../rand/rngs/enum.TimerError.html" title="enum rand::rngs::TimerError">TimerError</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#287-302' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Create a new <code>JitterRng</code>. Makes use of <code>std::time</code> for a timer, or a
platform-specific function with higher accuracy if necessary and
available.</p>
<p>During initialization CPU execution timing jitter is measured a few
hundred times. If this does not pass basic quality tests, an error is
returned. The test result is cached to make subsequent calls faster.</p>
</div><h4 id='method.new_with_timer' class="method"><span id='new_with_timer.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.new_with_timer' class='fnname'>new_with_timer</a>(timer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.fn.html">fn</a>() -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#349-357' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Create a new <code>JitterRng</code>.
A custom timer can be supplied, making it possible to use <code>JitterRng</code> in
<code>no_std</code> environments.</p>
<p>The timer must have nanosecond precision.</p>
<p>This method is more low-level than <code>new()</code>. It is the responsibility of
the caller to run <a href="struct.JitterRng.html#method.test_timer"><code>test_timer</code></a> before using any numbers generated with
<code>JitterRng</code>, and optionally call <a href="struct.JitterRng.html#method.set_rounds"><code>set_rounds</code></a>. Also it is important to
consume at least one <code>u64</code> before using the first result to initialize
the entropy collection pool.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rand</span>::<span class="ident">jitter</span>::<span class="ident">JitterRng</span>;
<span class="kw">fn</span> <span class="ident">get_nstime</span>() <span class="op">-&gt;</span> <span class="ident">u64</span> {
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">time</span>::{<span class="ident">SystemTime</span>, <span class="ident">UNIX_EPOCH</span>};
<span class="kw">let</span> <span class="ident">dur</span> <span class="op">=</span> <span class="ident">SystemTime</span>::<span class="ident">now</span>().<span class="ident">duration_since</span>(<span class="ident">UNIX_EPOCH</span>).<span class="ident">unwrap</span>();
<span class="comment">// The correct way to calculate the current time is</span>
<span class="comment">// `dur.as_secs() * 1_000_000_000 + dur.subsec_nanos() as u64`</span>
<span class="comment">// But this is faster, and the difference in terms of entropy is</span>
<span class="comment">// negligible (log2(10^9) == 29.9).</span>
<span class="ident">dur</span>.<span class="ident">as_secs</span>() <span class="op">&lt;&lt;</span> <span class="number">30</span> <span class="op">|</span> <span class="ident">dur</span>.<span class="ident">subsec_nanos</span>() <span class="kw">as</span> <span class="ident">u64</span>
}
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rng</span> <span class="op">=</span> <span class="ident">JitterRng</span>::<span class="ident">new_with_timer</span>(<span class="ident">get_nstime</span>);
<span class="kw">let</span> <span class="ident">rounds</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">test_timer</span>()<span class="question-mark">?</span>;
<span class="ident">rng</span>.<span class="ident">set_rounds</span>(<span class="ident">rounds</span>); <span class="comment">// optional</span>
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">gen</span>::<span class="op">&lt;</span><span class="ident">u64</span><span class="op">&gt;</span>();
<span class="comment">// Ready for use</span>
<span class="kw">let</span> <span class="ident">v</span>: <span class="ident">u64</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">gen</span>();
</pre>
</div><h4 id='method.set_rounds' class="method"><span id='set_rounds.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_rounds' class='fnname'>set_rounds</a>(&amp;mut self, rounds: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#369-372' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Configures how many rounds are used to generate each 64-bit value.
This must be greater than zero, and has a big impact on performance
and output quality.</p>
<p><a href="struct.JitterRng.html#method.new_with_timer"><code>new_with_timer</code></a> conservatively uses 64 rounds, but often less rounds
can be used. The <code>test_timer()</code> function returns the minimum number of
rounds required for full strength (platform dependent), so one may use
<code>rng.set_rounds(rng.test_timer()?);</code> or cache the value.</p>
</div><h4 id='method.test_timer' class="method"><span id='test_timer.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.test_timer' class='fnname'>test_timer</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, <a class="enum" href="../../rand/rngs/enum.TimerError.html" title="enum rand::rngs::TimerError">TimerError</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#614-749' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Basic quality tests on the timer, by measuring CPU timing jitter a few
hundred times.</p>
<p>If succesful, this will return the estimated number of rounds necessary
to collect 64 bits of entropy. Otherwise a <a href="enum.TimerError.html"><code>TimerError</code></a> with the cause
of the failure will be returned.</p>
</div><h4 id='method.timer_stats' class="method"><span id='timer_stats.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.timer_stats' class='fnname'>timer_stats</a>(&amp;mut self, var_rounds: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#765-773' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Statistical test: return the timer delta of one normal run of the
<code>JitterRng</code> entropy collector.</p>
<p>Setting <code>var_rounds</code> to <code>true</code> will execute the memory access and the
CPU jitter noice sources a variable amount of times (just like a real
<code>JitterRng</code> round).</p>
<p>Setting <code>var_rounds</code> to <code>false</code> will execute the noice sources the
minimal number of times. This can be used to measure the minimum amount
of entropy one round of the entropy collector can collect in the worst
case.</p>
<p>See <a href="struct.JitterRng.html#quality-testing">Quality testing</a> on how to
use <code>timer_stats</code> to test the quality of <code>JitterRng</code>.</p>
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#200-204' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#201-203' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id='impl-Clone' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-Clone' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#206-218' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#207-217' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130-132' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-RngCore' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../rand/trait.RngCore.html" title="trait rand::RngCore">RngCore</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-RngCore' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#825-855' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.next_u32' class="method"><span id='next_u32.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../rand/trait.RngCore.html#tymethod.next_u32' class='fnname'>next_u32</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#826-836' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Return the next random <code>u32</code>. <a href="../../rand/trait.RngCore.html#tymethod.next_u32">Read more</a></p>
</div><h4 id='method.next_u64' class="method"><span id='next_u64.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../rand/trait.RngCore.html#tymethod.next_u64' class='fnname'>next_u64</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#838-841' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Return the next random <code>u64</code>. <a href="../../rand/trait.RngCore.html#tymethod.next_u64">Read more</a></p>
</div><h4 id='method.fill_bytes' class="method"><span id='fill_bytes.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../rand/trait.RngCore.html#tymethod.fill_bytes' class='fnname'>fill_bytes</a>(&amp;mut self, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>)</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#843-850' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Fill <code>dest</code> with random data. <a href="../../rand/trait.RngCore.html#tymethod.fill_bytes">Read more</a></p>
</div><h4 id='method.try_fill_bytes' class="method"><span id='try_fill_bytes.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../rand/trait.RngCore.html#tymethod.try_fill_bytes' class='fnname'>try_fill_bytes</a>(&amp;mut self, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="../../rand/struct.Error.html" title="struct rand::Error">Error</a>&gt;</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#852-854' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Fill <code>dest</code> entirely with random data. <a href="../../rand/trait.RngCore.html#tymethod.try_fill_bytes">Read more</a></p>
</div></div><h3 id='impl-CryptoRng' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="../../rand/trait.CryptoRng.html" title="trait rand::CryptoRng">CryptoRng</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-CryptoRng' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/rand/rngs/jitter.rs.html#857' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Send' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../rand/rngs/struct.JitterRng.html" title="struct rand::rngs::JitterRng">JitterRng</a></code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "rand";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>