struct.JitterRng.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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="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,
  2. and jitter in memory access time.</p>
  3. <p>This is a true random number generator, as opposed to pseudo-random
  4. generators. Random numbers generated by <code>JitterRng</code> can be seen as fresh
  5. entropy. A consequence is that is orders of magnitude slower than <a href="struct.OsRng.html"><code>OsRng</code></a>
  6. and PRNGs (about 10<sup>3</sup>..10<sup>6</sup> slower).</p>
  7. <p>There are very few situations where using this RNG is appropriate. Only very
  8. few applications require true entropy. A normal PRNG can be statistically
  9. indistinguishable, and a cryptographic PRNG should also be as impossible to
  10. predict.</p>
  11. <p>Use of <code>JitterRng</code> is recommended for initializing cryptographic PRNGs when
  12. <a href="struct.OsRng.html"><code>OsRng</code></a> is not available.</p>
  13. <p><code>JitterRng</code> can be used without the standard library, but not conveniently,
  14. you must provide a high-precision timer and carefully have to follow the
  15. instructions of <a href="struct.JitterRng.html#method.new_with_timer"><code>new_with_timer</code></a>.</p>
  16. <p>This implementation is based on
  17. <a href="http://www.chronox.de/jent.html">Jitterentropy</a> version 2.1.0.</p>
  18. <p>Note: There is no accurate timer available on Wasm platforms, to help
  19. prevent fingerprinting or timing side-channel attacks. Therefore
  20. <a href="struct.JitterRng.html#method.new"><code>JitterRng::new()</code></a> is not available on Wasm.</p>
  21. <h1 id="quality-testing" class="section-header"><a href="#quality-testing">Quality testing</a></h1>
  22. <p><a href="struct.JitterRng.html#method.new"><code>JitterRng::new()</code></a> has build-in, but limited, quality testing, however
  23. before using <code>JitterRng</code> on untested hardware, or after changes that could
  24. effect how the code is optimized (such as a new LLVM version), it is
  25. recommend to run the much more stringent
  26. <a href="https://github.com/usnistgov/SP800-90B_EntropyAssessment">NIST SP 800-90B Entropy Estimation Suite</a>.</p>
  27. <p>Use the following code using <a href="struct.JitterRng.html#method.timer_stats"><code>timer_stats</code></a> to collect the data:</p>
  28. <pre class="rust rust-example-rendered">
  29. <span class="kw">use</span> <span class="ident">rand</span>::<span class="ident">jitter</span>::<span class="ident">JitterRng</span>;
  30. <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>;
  31. <span class="comment">// 1_000_000 results are required for the</span>
  32. <span class="comment">// NIST SP 800-90B Entropy Estimation Suite</span>
  33. <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>;
  34. <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>);
  35. <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>);
  36. <span class="kw">for</span> <span class="kw">_</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">ROUNDS</span> {
  37. <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>);
  38. <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>);
  39. }
  40. <span class="comment">// Write out after the statistics collection loop, to not disturb the</span>
  41. <span class="comment">// test results.</span>
  42. <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>;
  43. <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>
  44. <p>This will produce two files: <code>jitter_rng_var.bin</code> and <code>jitter_rng_min.bin</code>.
  45. Run the Entropy Estimation Suite in three configurations, as outlined below.
  46. Every run has two steps. One step to produce an estimation, another to
  47. validate the estimation.</p>
  48. <ol>
  49. <li>Estimate the expected amount of entropy that is at least available with
  50. each round of the entropy collector. This number should be greater than
  51. the amount estimated with <code>64 / test_timer()</code>.
  52. <pre><code class="language-sh">python noniid_main.py -v jitter_rng_var.bin 8
  53. restart.py -v jitter_rng_var.bin 8 &lt;min-entropy&gt;
  54. </code></pre>
  55. </li>
  56. <li>Estimate the expected amount of entropy that is available in the last 4
  57. bits of the timer delta after running noice sources. Note that a value of
  58. <code>3.70</code> is the minimum estimated entropy for true randomness.
  59. <pre><code class="language-sh">python noniid_main.py -v -u 4 jitter_rng_var.bin 4
  60. restart.py -v -u 4 jitter_rng_var.bin 4 &lt;min-entropy&gt;
  61. </code></pre>
  62. </li>
  63. <li>Estimate the expected amount of entropy that is available to the entropy
  64. collector if both noice sources only run their minimal number of times.
  65. This measures the absolute worst-case, and gives a lower bound for the
  66. available entropy.
  67. <pre><code class="language-sh">python noniid_main.py -v -u 4 jitter_rng_min.bin 4
  68. restart.py -v -u 4 jitter_rng_min.bin 4 &lt;min-entropy&gt;
  69. </code></pre>
  70. </li>
  71. </ol>
  72. </div>
  73. <h2 id='methods' class='small-section-header'>
  74. Methods<a href='#methods' class='anchor'></a>
  75. </h2>
  76. <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
  77. platform-specific function with higher accuracy if necessary and
  78. available.</p>
  79. <p>During initialization CPU execution timing jitter is measured a few
  80. hundred times. If this does not pass basic quality tests, an error is
  81. returned. The test result is cached to make subsequent calls faster.</p>
  82. </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>.
  83. A custom timer can be supplied, making it possible to use <code>JitterRng</code> in
  84. <code>no_std</code> environments.</p>
  85. <p>The timer must have nanosecond precision.</p>
  86. <p>This method is more low-level than <code>new()</code>. It is the responsibility of
  87. the caller to run <a href="struct.JitterRng.html#method.test_timer"><code>test_timer</code></a> before using any numbers generated with
  88. <code>JitterRng</code>, and optionally call <a href="struct.JitterRng.html#method.set_rounds"><code>set_rounds</code></a>. Also it is important to
  89. consume at least one <code>u64</code> before using the first result to initialize
  90. the entropy collection pool.</p>
  91. <h1 id="example" class="section-header"><a href="#example">Example</a></h1>
  92. <pre class="rust rust-example-rendered">
  93. <span class="kw">use</span> <span class="ident">rand</span>::<span class="ident">jitter</span>::<span class="ident">JitterRng</span>;
  94. <span class="kw">fn</span> <span class="ident">get_nstime</span>() <span class="op">-&gt;</span> <span class="ident">u64</span> {
  95. <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>};
  96. <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>();
  97. <span class="comment">// The correct way to calculate the current time is</span>
  98. <span class="comment">// `dur.as_secs() * 1_000_000_000 + dur.subsec_nanos() as u64`</span>
  99. <span class="comment">// But this is faster, and the difference in terms of entropy is</span>
  100. <span class="comment">// negligible (log2(10^9) == 29.9).</span>
  101. <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>
  102. }
  103. <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>);
  104. <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>;
  105. <span class="ident">rng</span>.<span class="ident">set_rounds</span>(<span class="ident">rounds</span>); <span class="comment">// optional</span>
  106. <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>();
  107. <span class="comment">// Ready for use</span>
  108. <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>();
  109. </pre>
  110. </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.
  111. This must be greater than zero, and has a big impact on performance
  112. and output quality.</p>
  113. <p><a href="struct.JitterRng.html#method.new_with_timer"><code>new_with_timer</code></a> conservatively uses 64 rounds, but often less rounds
  114. can be used. The <code>test_timer()</code> function returns the minimum number of
  115. rounds required for full strength (platform dependent), so one may use
  116. <code>rng.set_rounds(rng.test_timer()?);</code> or cache the value.</p>
  117. </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
  118. hundred times.</p>
  119. <p>If succesful, this will return the estimated number of rounds necessary
  120. to collect 64 bits of entropy. Otherwise a <a href="enum.TimerError.html"><code>TimerError</code></a> with the cause
  121. of the failure will be returned.</p>
  122. </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
  123. <code>JitterRng</code> entropy collector.</p>
  124. <p>Setting <code>var_rounds</code> to <code>true</code> will execute the memory access and the
  125. CPU jitter noice sources a variable amount of times (just like a real
  126. <code>JitterRng</code> round).</p>
  127. <p>Setting <code>var_rounds</code> to <code>false</code> will execute the noice sources the
  128. minimal number of times. This can be used to measure the minimum amount
  129. of entropy one round of the entropy collector can collect in the worst
  130. case.</p>
  131. <p>See <a href="struct.JitterRng.html#quality-testing">Quality testing</a> on how to
  132. use <code>timer_stats</code> to test the quality of <code>JitterRng</code>.</p>
  133. </div></div>
  134. <h2 id='implementations' class='small-section-header'>
  135. Trait Implementations<a href='#implementations' class='anchor'></a>
  136. </h2>
  137. <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>
  138. </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>
  139. </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>
  140. </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>
  141. </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>
  142. </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>
  143. </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>
  144. </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>
  145. <h2 id='synthetic-implementations' class='small-section-header'>
  146. Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a>
  147. </h2>
  148. <div id='synthetic-implementations-list'>
  149. <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>