mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-18 08:39:53 +00:00
deploy: de38ae62916547ad097c066f94a32e9ba7790eeb
This commit is contained in:
commit
9a86359447
28502 changed files with 1261284 additions and 0 deletions
32
rand/index.html
Normal file
32
rand/index.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!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="Utilities for random number generation"><title>rand - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../rand/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../rand/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk.png" alt="logo"></a><h2><a href="../rand/index.html">rand</a><span class="version">0.8.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="#">Sections</a></h3><ul class="block top-toc"><li><a href="#quick-start" title="Quick Start">Quick Start</a></li><li><a href="#the-book" title="The Book">The Book</a></li></ul><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><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>rand</span><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/lib.rs.html#10-214">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Utilities for random number generation</p>
|
||||
<p>Rand provides utilities to generate random numbers, to convert them to
|
||||
useful types and distributions, and some randomness-related algorithms.</p>
|
||||
<h2 id="quick-start"><a class="doc-anchor" href="#quick-start">§</a>Quick Start</h2>
|
||||
<p>To get you started quickly, the easiest and highest-level way to get
|
||||
a random value is to use <a href="fn.random.html" title="fn rand::random"><code>random()</code></a>; alternatively you can use
|
||||
<a href="fn.thread_rng.html" title="fn rand::thread_rng"><code>thread_rng()</code></a>. The <a href="trait.Rng.html" title="trait rand::Rng"><code>Rng</code></a> trait provides a useful API on all RNGs, while
|
||||
the <a href="distributions/index.html" title="mod rand::distributions"><code>distributions</code></a> and <a href="seq/index.html" title="mod rand::seq"><code>seq</code></a> modules provide further
|
||||
functionality on top of RNGs.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rand::prelude::<span class="kw-2">*</span>;
|
||||
|
||||
<span class="kw">if </span>rand::random() { <span class="comment">// generates a boolean
|
||||
// Try printing a random unicode code point (probably a bad idea)!
|
||||
</span><span class="macro">println!</span>(<span class="string">"char: {}"</span>, rand::random::<char>());
|
||||
}
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>rng = rand::thread_rng();
|
||||
<span class="kw">let </span>y: f64 = rng.gen(); <span class="comment">// generates a float between 0 and 1
|
||||
|
||||
</span><span class="kw">let </span><span class="kw-2">mut </span>nums: Vec<i32> = (<span class="number">1</span>..<span class="number">100</span>).collect();
|
||||
nums.shuffle(<span class="kw-2">&mut </span>rng);</code></pre></div>
|
||||
<h2 id="the-book"><a class="doc-anchor" href="#the-book">§</a>The Book</h2>
|
||||
<p>For the user guide and further documentation, please read
|
||||
<a href="https://rust-random.github.io/book">The Rust Rand Book</a>.</p>
|
||||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="distributions/index.html" title="mod rand::distributions">distributions</a></div><div class="desc docblock-short">Generating random samples from probability distributions</div></li><li><div class="item-name"><a class="mod" href="prelude/index.html" title="mod rand::prelude">prelude</a></div><div class="desc docblock-short">Convenience re-export of common members</div></li><li><div class="item-name"><a class="mod" href="rngs/index.html" title="mod rand::rngs">rngs</a></div><div class="desc docblock-short">Random number generators and adapters</div></li><li><div class="item-name"><a class="mod" href="seq/index.html" title="mod rand::seq">seq</a></div><div class="desc docblock-short">Sequence-related functionality</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Error.html" title="struct rand::Error">Error</a></div><div class="desc docblock-short">Error type of random number generators</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.CryptoRng.html" title="trait rand::CryptoRng">Crypto<wbr>Rng</a></div><div class="desc docblock-short">A marker trait used to indicate that an <a href="trait.RngCore.html" title="trait rand::RngCore"><code>RngCore</code></a> or <a href="../rand_core/block/trait.BlockRngCore.html" title="trait rand_core::block::BlockRngCore"><code>BlockRngCore</code></a>
|
||||
implementation is supposed to be cryptographically secure.</div></li><li><div class="item-name"><a class="trait" href="trait.Fill.html" title="trait rand::Fill">Fill</a></div><div class="desc docblock-short">Types which may be filled with random data</div></li><li><div class="item-name"><a class="trait" href="trait.Rng.html" title="trait rand::Rng">Rng</a></div><div class="desc docblock-short">An automatically-implemented extension trait on <a href="trait.RngCore.html" title="trait rand::RngCore"><code>RngCore</code></a> providing high-level
|
||||
generic methods for sampling values and other convenience methods.</div></li><li><div class="item-name"><a class="trait" href="trait.RngCore.html" title="trait rand::RngCore">RngCore</a></div><div class="desc docblock-short">The core of a random number generator.</div></li><li><div class="item-name"><a class="trait" href="trait.SeedableRng.html" title="trait rand::SeedableRng">Seedable<wbr>Rng</a></div><div class="desc docblock-short">A random number generator that can be explicitly seeded.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.random.html" title="fn rand::random">random</a></div><div class="desc docblock-short">Generates a random value using the thread-local random number generator.</div></li><li><div class="item-name"><a class="fn" href="fn.thread_rng.html" title="fn rand::thread_rng">thread_<wbr>rng</a></div><div class="desc docblock-short">Retrieve the lazily-initialized thread-local random number generator,
|
||||
seeded by the system. Intended to be used in method chaining style,
|
||||
e.g. <code>thread_rng().gen::<i32>()</code>, or cached locally, e.g.
|
||||
<code>let mut rng = thread_rng();</code>. Invoked by the <code>Default</code> trait, making
|
||||
<code>ThreadRng::default()</code> equivalent.</div></li></ul></section></div></main></body></html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue