index.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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 `rand` crate."><meta name="keywords" content="rust, rustlang, rust-lang, rand"><title>rand - 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 mod"><!--[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'>Crate rand</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'rand', ty: 'mod', relpath: '../'};</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'>Crate <a class="mod" href=''>rand</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/lib.rs.html#11-1252' title='goto source code'>[src]</a></span></h1><div class='docblock'><p>Utilities for random number generation</p>
  2. <p>Rand provides utilities to generate random numbers, to convert them to
  3. useful types and distributions, and some randomness-related algorithms.</p>
  4. <h1 id="basic-usage" class="section-header"><a href="#basic-usage">Basic usage</a></h1>
  5. <p>To get you started quickly, the easiest and highest-level way to get
  6. a random value is to use <a href="fn.random.html"><code>random()</code></a>.</p>
  7. <pre class="rust rust-example-rendered">
  8. <span class="kw">let</span> <span class="ident">x</span>: <span class="ident">u8</span> <span class="op">=</span> <span class="ident">rand</span>::<span class="ident">random</span>();
  9. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">x</span>);
  10. <span class="kw">let</span> <span class="ident">y</span> <span class="op">=</span> <span class="ident">rand</span>::<span class="ident">random</span>::<span class="op">&lt;</span><span class="ident">f64</span><span class="op">&gt;</span>();
  11. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">y</span>);
  12. <span class="kw">if</span> <span class="ident">rand</span>::<span class="ident">random</span>() { <span class="comment">// generates a boolean</span>
  13. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Heads!&quot;</span>);
  14. }</pre>
  15. <p>This supports generating most common types but is not very flexible, thus
  16. you probably want to learn a bit more about the Rand library.</p>
  17. <h1 id="the-two-step-process-to-get-a-random-value" class="section-header"><a href="#the-two-step-process-to-get-a-random-value">The two-step process to get a random value</a></h1>
  18. <p>Generating random values is typically a two-step process:</p>
  19. <ul>
  20. <li>get some <em>random data</em> (an integer or bit/byte sequence) from a random
  21. number generator (RNG);</li>
  22. <li>use some function to transform that <em>data</em> into the type of value you want
  23. (this function is an implementation of some <em>distribution</em> describing the
  24. kind of value produced).</li>
  25. </ul>
  26. <p>Rand represents the first step with the <a href="trait.RngCore.html"><code>RngCore</code></a> trait and the second
  27. step via a combination of the <a href="trait.Rng.html"><code>Rng</code></a> extension trait and the
  28. <a href="distributions/index.html"><code>distributions</code> module</a>.
  29. In practice you probably won't use <a href="trait.RngCore.html"><code>RngCore</code></a> directly unless you are
  30. implementing a random number generator (RNG).</p>
  31. <p>There are many kinds of RNGs, with different trade-offs. You can read more
  32. about them in the <a href="rngs/index.html"><code>rngs</code> module</a> and even more in the <a href="prng/index.html"><code>prng</code> module</a>,
  33. however, often you can just use <a href="fn.thread_rng.html"><code>thread_rng()</code></a>. This function
  34. automatically initializes an RNG in thread-local memory, then returns a
  35. reference to it. It is fast, good quality, and secure (unpredictable).</p>
  36. <p>To turn the output of the RNG into something usable, you usually want to use
  37. the methods from the <a href="trait.Rng.html"><code>Rng</code></a> trait. Some of the most useful methods are:</p>
  38. <ul>
  39. <li><a href="trait.Rng.html#method.gen"><code>gen</code></a> generates a random value appropriate for the type (just like
  40. <a href="fn.random.html"><code>random()</code></a>). For integers this is normally the full representable range
  41. (e.g. from <code>0u32</code> to <code>std::u32::MAX</code>), for floats this is between 0 and 1,
  42. and some other types are supported, including arrays and tuples. See the
  43. <a href="distributions/struct.Standard.html"><code>Standard</code></a> distribution which provides the implementations.</li>
  44. <li><a href="trait.Rng.html#method.gen_range"><code>gen_range</code></a> samples from a specific range of values; this is like
  45. <a href="trait.Rng.html#method.gen"><code>gen</code></a> but with specific upper and lower bounds.</li>
  46. <li><a href="trait.Rng.html#method.sample"><code>sample</code></a> samples directly from some distribution.</li>
  47. </ul>
  48. <p><a href="fn.random.html"><code>random()</code></a> is defined using just the above: <code>thread_rng().gen()</code>.</p>
  49. <h2 id="distributions" class="section-header"><a href="#distributions">Distributions</a></h2>
  50. <p>What are distributions, you ask? Specifying only the type and range of
  51. values (known as the <em>sample space</em>) is not enough; samples must also have
  52. a <em>probability distribution</em>, describing the relative probability of
  53. sampling each value in that space.</p>
  54. <p>In many cases a <em>uniform</em> distribution is used, meaning roughly that each
  55. value is equally likely (or for &quot;continuous&quot; types like floats, that each
  56. equal-sized sub-range has the same probability of containing a sample).
  57. <a href="trait.Rng.html#method.gen"><code>gen</code></a> and <a href="trait.Rng.html#method.gen_range"><code>gen_range</code></a> both use statistically uniform distributions.</p>
  58. <p>The <a href="distributions/index.html"><code>distributions</code> module</a> provides implementations
  59. of some other distributions, including Normal, Log-Normal and Exponential.</p>
  60. <p>It is worth noting that the functionality already mentioned is implemented
  61. with distributions: <a href="trait.Rng.html#method.gen"><code>gen</code></a> samples values using the <a href="distributions/struct.Standard.html"><code>Standard</code></a>
  62. distribution, while <a href="trait.Rng.html#method.gen_range"><code>gen_range</code></a> uses <a href="distributions/struct.Uniform.html"><code>Uniform</code></a>.</p>
  63. <h2 id="importing-prelude" class="section-header"><a href="#importing-prelude">Importing (prelude)</a></h2>
  64. <p>The most convenient way to import items from Rand is to use the <a href="prelude/index.html">prelude</a>.
  65. This includes the most important parts of Rand, but only those unlikely to
  66. cause name conflicts.</p>
  67. <p>Note that Rand 0.5 has significantly changed the module organization and
  68. contents relative to previous versions. Where possible old names have been
  69. kept (but are hidden in the documentation), however these will be removed
  70. in the future. We therefore recommend migrating to use the prelude or the
  71. new module organization in your imports.</p>
  72. <h2 id="examples" class="section-header"><a href="#examples">Examples</a></h2>
  73. <pre class="rust rust-example-rendered">
  74. <span class="kw">use</span> <span class="ident">rand</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
  75. <span class="comment">// thread_rng is often the most convenient source of randomness:</span>
  76. <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rng</span> <span class="op">=</span> <span class="ident">thread_rng</span>();
  77. <span class="kw">if</span> <span class="ident">rng</span>.<span class="ident">gen</span>() { <span class="comment">// random bool</span>
  78. <span class="kw">let</span> <span class="ident">x</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">gen</span>(); <span class="comment">// random number in range [0, 1)</span>
  79. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;x is: {}&quot;</span>, <span class="ident">x</span>);
  80. <span class="kw">let</span> <span class="ident">ch</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">gen</span>::<span class="op">&lt;</span><span class="ident">char</span><span class="op">&gt;</span>(); <span class="comment">// using type annotation</span>
  81. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;char is: {}&quot;</span>, <span class="ident">ch</span>);
  82. <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;Number from 0 to 9: {}&quot;</span>, <span class="ident">rng</span>.<span class="ident">gen_range</span>(<span class="number">0</span>, <span class="number">10</span>));
  83. }</pre>
  84. <h1 id="more-functionality" class="section-header"><a href="#more-functionality">More functionality</a></h1>
  85. <p>The <a href="trait.Rng.html"><code>Rng</code></a> trait includes a few more methods not mentioned above:</p>
  86. <ul>
  87. <li><a href="trait.Rng.html#method.sample_iter"><code>Rng::sample_iter</code></a> allows iterating over values from a chosen
  88. distribution.</li>
  89. <li><a href="trait.Rng.html#method.gen_bool"><code>Rng::gen_bool</code></a> generates boolean &quot;events&quot; with a given probability.</li>
  90. <li><a href="trait.Rng.html#method.fill"><code>Rng::fill</code></a> and <a href="trait.Rng.html#method.try_fill"><code>Rng::try_fill</code></a> are fast alternatives to fill a slice
  91. of integers.</li>
  92. <li><a href="trait.Rng.html#method.shuffle"><code>Rng::shuffle</code></a> randomly shuffles elements in a slice.</li>
  93. <li><a href="trait.Rng.html#method.choose"><code>Rng::choose</code></a> picks one element at random from a slice.</li>
  94. </ul>
  95. <p>For more slice/sequence related functionality, look in the <a href="seq/index.html"><code>seq</code> module</a>.</p>
  96. <p>There is also <a href="distributions/struct.WeightedChoice.html"><code>distributions::WeightedChoice</code></a>, which can be used to pick
  97. elements at random with some probability. But it does not work well at the
  98. moment and is going through a redesign.</p>
  99. <h1 id="error-handling" class="section-header"><a href="#error-handling">Error handling</a></h1>
  100. <p>Error handling in Rand is a compromise between simplicity and necessity.
  101. Most RNGs and sampling functions will never produce errors, and making these
  102. able to handle errors would add significant overhead (to code complexity
  103. and ergonomics of usage at least, and potentially also performance,
  104. depending on the approach).
  105. However, external RNGs can fail, and being able to handle this is important.</p>
  106. <p>It has therefore been decided that <em>most</em> methods should not return a
  107. <code>Result</code> type, with as exceptions <a href="trait.Rng.html#method.try_fill"><code>Rng::try_fill</code></a>,
  108. <a href="trait.RngCore.html#method.try_fill_bytes"><code>RngCore::try_fill_bytes</code></a>, and <a href="trait.SeedableRng.html#method.from_rng"><code>SeedableRng::from_rng</code></a>.</p>
  109. <p>Note that it is the RNG that panics when it fails but is not used through a
  110. method that can report errors. Currently Rand contains only three RNGs that
  111. can return an error (and thus may panic), and documents this property:
  112. <a href="rngs/struct.OsRng.html"><code>OsRng</code></a>, <a href="rngs/struct.EntropyRng.html"><code>EntropyRng</code></a> and <a href="rngs/adapter/struct.ReadRng.html"><code>ReadRng</code></a>. Other RNGs, like <a href="rngs/struct.ThreadRng.html"><code>ThreadRng</code></a>
  113. and <a href="rngs/struct.StdRng.html"><code>StdRng</code></a>, can be used with all methods without concern.</p>
  114. <p>One further problem is that if Rand is unable to get any external randomness
  115. when initializing an RNG with <a href="rngs/struct.EntropyRng.html"><code>EntropyRng</code></a>, it will panic in
  116. <a href="trait.FromEntropy.html#tymethod.from_entropy"><code>FromEntropy::from_entropy</code></a>, and notably in <a href="fn.thread_rng.html"><code>thread_rng()</code></a>. Except by
  117. compromising security, this problem is as unsolvable as running out of
  118. memory.</p>
  119. <h1 id="distinction-between-rand-and-rand_core" class="section-header"><a href="#distinction-between-rand-and-rand_core">Distinction between Rand and <code>rand_core</code></a></h1>
  120. <p>The <a href="https://crates.io/crates/rand_core"><code>rand_core</code></a> crate provides the necessary traits and functionality for
  121. implementing RNGs; this includes the <a href="trait.RngCore.html"><code>RngCore</code></a> and <a href="trait.SeedableRng.html"><code>SeedableRng</code></a> traits
  122. and the <a href="struct.Error.html"><code>Error</code></a> type.
  123. Crates implementing RNGs should depend on <a href="https://crates.io/crates/rand_core"><code>rand_core</code></a>.</p>
  124. <p>Applications and libraries consuming random values are encouraged to use the
  125. Rand crate, which re-exports the common parts of <a href="https://crates.io/crates/rand_core"><code>rand_core</code></a>.</p>
  126. <h1 id="more-examples" class="section-header"><a href="#more-examples">More examples</a></h1>
  127. <p>For some inspiration, see the examples:</p>
  128. <ul>
  129. <li><a href="https://github.com/rust-lang-nursery/rand/blob/master/examples/monte-carlo.rs">Monte Carlo estimation of π</a></li>
  130. <li><a href="https://github.com/rust-lang-nursery/rand/blob/master/examples/monty-hall.rs">Monty Hall Problem</a></li>
  131. </ul>
  132. </div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
  133. <table>
  134. <tr class=' module-item'>
  135. <td><a class="mod" href="distributions/index.html"
  136. title='mod rand::distributions'>distributions</a></td>
  137. <td class='docblock-short'>
  138. <p>Generating random samples from probability distributions.</p>
  139. </td>
  140. </tr>
  141. <tr class=' module-item'>
  142. <td><a class="mod" href="prelude/index.html"
  143. title='mod rand::prelude'>prelude</a></td>
  144. <td class='docblock-short'>
  145. <p>Convenience re-export of common members</p>
  146. </td>
  147. </tr>
  148. <tr class=' module-item'>
  149. <td><a class="mod" href="prng/index.html"
  150. title='mod rand::prng'>prng</a></td>
  151. <td class='docblock-short'>
  152. <p>Pseudo-random number generators.</p>
  153. </td>
  154. </tr>
  155. <tr class=' module-item'>
  156. <td><a class="mod" href="rngs/index.html"
  157. title='mod rand::rngs'>rngs</a></td>
  158. <td class='docblock-short'>
  159. <p>Random number generators and adapters for common usage:</p>
  160. </td>
  161. </tr>
  162. <tr class=' module-item'>
  163. <td><a class="mod" href="seq/index.html"
  164. title='mod rand::seq'>seq</a></td>
  165. <td class='docblock-short'>
  166. <p>Functions for randomly accessing and sampling sequences.</p>
  167. </td>
  168. </tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
  169. <table>
  170. <tr class=' module-item'>
  171. <td><a class="struct" href="struct.AsciiGenerator.html"
  172. title='struct rand::AsciiGenerator'>AsciiGenerator</a></td>
  173. <td class='docblock-short'>
  174. [<div class='stab deprecated'>Deprecated</div>] <p>Iterator which will continuously generate random ascii characters.</p>
  175. </td>
  176. </tr>
  177. <tr class=' module-item'>
  178. <td><a class="struct" href="struct.Error.html"
  179. title='struct rand::Error'>Error</a></td>
  180. <td class='docblock-short'>
  181. <p>Error type of random number generators</p>
  182. </td>
  183. </tr>
  184. <tr class=' module-item'>
  185. <td><a class="struct" href="struct.Generator.html"
  186. title='struct rand::Generator'>Generator</a></td>
  187. <td class='docblock-short'>
  188. [<div class='stab deprecated'>Deprecated</div>] <p>Iterator which will generate a stream of random items.</p>
  189. </td>
  190. </tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
  191. <table>
  192. <tr class=' module-item'>
  193. <td><a class="enum" href="enum.ErrorKind.html"
  194. title='enum rand::ErrorKind'>ErrorKind</a></td>
  195. <td class='docblock-short'>
  196. <p>Error kind which can be matched over.</p>
  197. </td>
  198. </tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
  199. <table>
  200. <tr class=' module-item'>
  201. <td><a class="trait" href="trait.AsByteSliceMut.html"
  202. title='trait rand::AsByteSliceMut'>AsByteSliceMut</a></td>
  203. <td class='docblock-short'>
  204. <p>Trait for casting types to byte slices</p>
  205. </td>
  206. </tr>
  207. <tr class=' module-item'>
  208. <td><a class="trait" href="trait.CryptoRng.html"
  209. title='trait rand::CryptoRng'>CryptoRng</a></td>
  210. <td class='docblock-short'>
  211. <p>A marker trait used to indicate that an <a href="trait.RngCore.html"><code>RngCore</code></a> or <a href="../rand_core/block/trait.BlockRngCore.html"><code>BlockRngCore</code></a>
  212. implementation is supposed to be cryptographically secure.</p>
  213. </td>
  214. </tr>
  215. <tr class=' module-item'>
  216. <td><a class="trait" href="trait.FromEntropy.html"
  217. title='trait rand::FromEntropy'>FromEntropy</a></td>
  218. <td class='docblock-short'>
  219. <p>A convenience extension to <a href="trait.SeedableRng.html"><code>SeedableRng</code></a> allowing construction from fresh
  220. entropy. This trait is automatically implemented for any PRNG implementing
  221. <a href="trait.SeedableRng.html"><code>SeedableRng</code></a> and is not intended to be implemented by users.</p>
  222. </td>
  223. </tr>
  224. <tr class=' module-item'>
  225. <td><a class="trait" href="trait.Rand.html"
  226. title='trait rand::Rand'>Rand</a></td>
  227. <td class='docblock-short'>
  228. [<div class='stab deprecated'>Deprecated</div>] <p>A type that can be randomly generated using an <a href="trait.Rng.html"><code>Rng</code></a>.</p>
  229. </td>
  230. </tr>
  231. <tr class=' module-item'>
  232. <td><a class="trait" href="trait.Rng.html"
  233. title='trait rand::Rng'>Rng</a></td>
  234. <td class='docblock-short'>
  235. <p>An automatically-implemented extension trait on <a href="trait.RngCore.html"><code>RngCore</code></a> providing high-level
  236. generic methods for sampling values and other convenience methods.</p>
  237. </td>
  238. </tr>
  239. <tr class=' module-item'>
  240. <td><a class="trait" href="trait.RngCore.html"
  241. title='trait rand::RngCore'>RngCore</a></td>
  242. <td class='docblock-short'>
  243. <p>The core of a random number generator.</p>
  244. </td>
  245. </tr>
  246. <tr class=' module-item'>
  247. <td><a class="trait" href="trait.SeedableRng.html"
  248. title='trait rand::SeedableRng'>SeedableRng</a></td>
  249. <td class='docblock-short'>
  250. <p>A random number generator that can be explicitly seeded.</p>
  251. </td>
  252. </tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
  253. <table>
  254. <tr class=' module-item'>
  255. <td><a class="fn" href="fn.random.html"
  256. title='fn rand::random'>random</a></td>
  257. <td class='docblock-short'>
  258. <p>Generates a random value using the thread-local random number generator.</p>
  259. </td>
  260. </tr>
  261. <tr class=' module-item'>
  262. <td><a class="fn" href="fn.sample.html"
  263. title='fn rand::sample'>sample</a></td>
  264. <td class='docblock-short'>
  265. [<div class='stab deprecated'>Deprecated</div>] <p>DEPRECATED: use <code>seq::sample_iter</code> instead.</p>
  266. </td>
  267. </tr>
  268. <tr class=' module-item'>
  269. <td><a class="fn" href="fn.thread_rng.html"
  270. title='fn rand::thread_rng'>thread_rng</a></td>
  271. <td class='docblock-short'>
  272. <p>Retrieve the lazily-initialized thread-local random number
  273. generator, seeded by the system. Intended to be used in method
  274. chaining style, e.g. <code>thread_rng().gen::&lt;i32&gt;()</code>, or cached locally, e.g.
  275. <code>let mut rng = thread_rng();</code>.</p>
  276. </td>
  277. </tr>
  278. <tr class=' module-item'>
  279. <td><a class="fn" href="fn.weak_rng.html"
  280. title='fn rand::weak_rng'>weak_rng</a></td>
  281. <td class='docblock-short'>
  282. [<div class='stab deprecated'>Deprecated</div>] <p>DEPRECATED: use <a href="rngs/struct.SmallRng.html"><code>SmallRng</code></a> instead.</p>
  283. </td>
  284. </tr></table></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>