Adding large folders

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@@ -0,0 +1,55 @@
<!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="Generating random samples from probability distributions"><title>rand::distr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module distr</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module distr</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#the-standard-uniform-distribution" title="The Standard Uniform distribution">The Standard Uniform distribution</a><ul><li><a href="#other-standard-uniform-distributions" title="Other standard uniform distributions">Other standard uniform distributions</a></li></ul></li><li><a href="#parameterized-uniform-distributions" title="Parameterized Uniform distributions">Parameterized Uniform distributions</a></li><li><a href="#non-uniform-sampling" title="Non-uniform sampling">Non-uniform sampling</a></li></ul><h3><a href="#modules">Module 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="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate rand</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand</a></div><h1>Module <span>distr</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand/distr/mod.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>Generating random samples from probability distributions</p>
<p>This module is the home of the <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution</code></a> trait and several of its
implementations. It is the workhorse behind some of the convenient
functionality of the <a href="../trait.Rng.html" title="trait rand::Rng"><code>Rng</code></a> trait, e.g. <a href="../trait.Rng.html#method.random" title="method rand::Rng::random"><code>Rng::random</code></a> and of course
<a href="../trait.Rng.html#method.sample" title="method rand::Rng::sample"><code>Rng::sample</code></a>.</p>
<p>Abstractly, a <a href="https://en.wikipedia.org/wiki/Probability_distribution">probability distribution</a> describes the probability of
occurrence of each value in its sample space.</p>
<p>More concretely, an implementation of <code>Distribution&lt;T&gt;</code> for type <code>X</code> is an
algorithm for choosing values from the sample space (a subset of <code>T</code>)
according to the distribution <code>X</code> represents, using an external source of
randomness (an RNG supplied to the <code>sample</code> function).</p>
<p>A type <code>X</code> may implement <code>Distribution&lt;T&gt;</code> for multiple types <code>T</code>.
Any type implementing <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution</code></a> is stateless (i.e. immutable),
but it may have internal parameters set at construction time (for example,
<a href="struct.Uniform.html" title="struct rand::distr::Uniform"><code>Uniform</code></a> allows specification of its sample space as a range within <code>T</code>).</p>
<h2 id="the-standard-uniform-distribution"><a class="doc-anchor" href="#the-standard-uniform-distribution">§</a>The Standard Uniform distribution</h2>
<p>The <a href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform"><code>StandardUniform</code></a> distribution is important to mention. This is the
distribution used by <a href="../trait.Rng.html#method.random" title="method rand::Rng::random"><code>Rng::random</code></a> and represents the “default” way to
produce a random value for many different types, including most primitive
types, tuples, arrays, and a few derived types. See the documentation of
<a href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform"><code>StandardUniform</code></a> for more details.</p>
<p>Implementing <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution&lt;T&gt;</code></a> for <a href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform"><code>StandardUniform</code></a> for user types <code>T</code> makes it
possible to generate type <code>T</code> with <a href="../trait.Rng.html#method.random" title="method rand::Rng::random"><code>Rng::random</code></a>, and by extension also
with the <a href="../fn.random.html" title="fn rand::random"><code>random</code></a> function.</p>
<h3 id="other-standard-uniform-distributions"><a class="doc-anchor" href="#other-standard-uniform-distributions">§</a>Other standard uniform distributions</h3>
<p><a href="struct.Alphanumeric.html" title="struct rand::distr::Alphanumeric"><code>Alphanumeric</code></a> is a simple distribution to sample random letters and
numbers of the <code>char</code> type; in contrast <a href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform"><code>StandardUniform</code></a> may sample any valid
<code>char</code>.</p>
<p>Theres also an <a href="struct.Alphabetic.html" title="struct rand::distr::Alphabetic"><code>Alphabetic</code></a> distribution which acts similarly to <a href="struct.Alphanumeric.html" title="struct rand::distr::Alphanumeric"><code>Alphanumeric</code></a> but
doesnt include digits.</p>
<p>For floats (<code>f32</code>, <code>f64</code>), <a href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform"><code>StandardUniform</code></a> samples from <code>[0, 1)</code>. Also
provided are <a href="struct.Open01.html" title="struct rand::distr::Open01"><code>Open01</code></a> (samples from <code>(0, 1)</code>) and <a href="struct.OpenClosed01.html" title="struct rand::distr::OpenClosed01"><code>OpenClosed01</code></a>
(samples from <code>(0, 1]</code>). No option is provided to sample from <code>[0, 1]</code>; it
is suggested to use one of the above half-open ranges since the failure to
sample a value which would have a low chance of being sampled anyway is
rarely an issue in practice.</p>
<h2 id="parameterized-uniform-distributions"><a class="doc-anchor" href="#parameterized-uniform-distributions">§</a>Parameterized Uniform distributions</h2>
<p>The <a href="struct.Uniform.html" title="struct rand::distr::Uniform"><code>Uniform</code></a> distribution provides uniform sampling over a specified
range on a subset of the types supported by the above distributions.</p>
<p>Implementations support single-value-sampling via
<a href="../trait.Rng.html#method.random_range" title="method rand::Rng::random_range"><code>Rng::random_range(Range)</code></a>.
Where a fixed (non-<code>const</code>) range will be sampled many times, it is likely
faster to pre-construct a <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution</code></a> object using
<a href="struct.Uniform.html#method.new" title="associated function rand::distr::Uniform::new"><code>Uniform::new</code></a>, <a href="struct.Uniform.html#method.new_inclusive" title="associated function rand::distr::Uniform::new_inclusive"><code>Uniform::new_inclusive</code></a> or <code>From&lt;Range&gt;</code>.</p>
<h2 id="non-uniform-sampling"><a class="doc-anchor" href="#non-uniform-sampling">§</a>Non-uniform sampling</h2>
<p>Sampling a simple true/false outcome with a given probability has a name:
the <a href="struct.Bernoulli.html" title="struct rand::distr::Bernoulli"><code>Bernoulli</code></a> distribution (this is used by <a href="../trait.Rng.html#method.random_bool" title="method rand::Rng::random_bool"><code>Rng::random_bool</code></a>).</p>
<p>For weighted sampling of discrete values see the <a href="weighted/index.html" title="mod rand::distr::weighted"><code>weighted</code></a> module.</p>
<p>This crate no longer includes other non-uniform distributions; instead
it is recommended that you use either <a href="https://crates.io/crates/rand_distr"><code>rand_distr</code></a> or <a href="https://crates.io/crates/statrs"><code>statrs</code></a>.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="slice/index.html" title="mod rand::distr::slice">slice</a></dt><dd>Distributions over slices</dd><dt><a class="mod" href="uniform/index.html" title="mod rand::distr::uniform">uniform</a></dt><dd>A distribution uniformly sampling numbers within a given range.</dd><dt><a class="mod" href="weighted/index.html" title="mod rand::distr::weighted">weighted</a></dt><dd>Weighted (index) sampling</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Alphabetic.html" title="struct rand::distr::Alphabetic">Alphabetic</a></dt><dd>Sample a <a href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html" title="primitive u8"><code>u8</code></a>, uniformly distributed over letters:
a-z and A-Z.</dd><dt><a class="struct" href="struct.Alphanumeric.html" title="struct rand::distr::Alphanumeric">Alphanumeric</a></dt><dd>Sample a <code>u8</code>, uniformly distributed over ASCII letters and numbers:
a-z, A-Z and 0-9.</dd><dt><a class="struct" href="struct.Bernoulli.html" title="struct rand::distr::Bernoulli">Bernoulli</a></dt><dd>The <a href="https://en.wikipedia.org/wiki/Bernoulli_distribution">Bernoulli distribution</a> <code>Bernoulli(p)</code>.</dd><dt><a class="struct" href="struct.Iter.html" title="struct rand::distr::Iter">Iter</a></dt><dd>An iterator over a <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution</code></a></dd><dt><a class="struct" href="struct.Map.html" title="struct rand::distr::Map">Map</a></dt><dd>A <a href="trait.Distribution.html" title="trait rand::distr::Distribution"><code>Distribution</code></a> which maps sampled values to type <code>S</code></dd><dt><a class="struct" href="struct.Open01.html" title="struct rand::distr::Open01">Open01</a></dt><dd>A distribution to sample floating point numbers uniformly in the open
interval <code>(0, 1)</code>, i.e. not including either endpoint.</dd><dt><a class="struct" href="struct.OpenClosed01.html" title="struct rand::distr::OpenClosed01">Open<wbr>Closed01</a></dt><dd>A distribution to sample floating point numbers uniformly in the half-open
interval <code>(0, 1]</code>, i.e. including 1 but not 0.</dd><dt><a class="struct" href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform">Standard<wbr>Uniform</a></dt><dd>The Standard Uniform distribution</dd><dt><a class="struct" href="struct.Uniform.html" title="struct rand::distr::Uniform">Uniform</a></dt><dd>Sample values uniformly between two bounds.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.BernoulliError.html" title="enum rand::distr::BernoulliError">Bernoulli<wbr>Error</a></dt><dd>Error type returned from <a href="struct.Bernoulli.html#method.new" title="associated function rand::distr::Bernoulli::new"><code>Bernoulli::new</code></a>.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Distribution.html" title="trait rand::distr::Distribution">Distribution</a></dt><dd>Types (distributions) that can be used to create a random instance of <code>T</code>.</dd><dt><a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">Sample<wbr>String</a></dt><dd>Sample or extend a <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String"><code>String</code></a></dd></dl></section></div></main></body></html>

View File

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

View File

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

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["BernoulliError"],"mod":["slice","uniform","weighted"],"struct":["Alphabetic","Alphanumeric","Bernoulli","Iter","Map","Open01","OpenClosed01","StandardUniform","Uniform"],"trait":["Distribution","SampleString"]};

View File

@@ -0,0 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Distributions over slices"><title>rand::distr::slice - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module slice</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module slice</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In rand::<wbr>distr</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">rand</a>::<wbr><a href="../index.html">distr</a></div><h1>Module <span>slice</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/rand/distr/slice.rs.html#9-167">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Distributions over slices</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Choose.html" title="struct rand::distr::slice::Choose">Choose</a></dt><dd>A distribution to uniformly sample elements of a slice</dd><dt><a class="struct" href="struct.Empty.html" title="struct rand::distr::slice::Empty">Empty</a></dt><dd>Error: empty slice</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Choose","Empty"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Sample or extend a `String`"><title>SampleString in rand::distr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SampleString</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Sample<wbr>String</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.append_string" title="append_string">append_string</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.sample_string" title="sample_string">sample_string</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand::<wbr>distr</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">rand</a>::<wbr><a href="index.html">distr</a></div><h1>Trait <span class="trait">Sample<wbr>String</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/rand/distr/distribution.rs.html#183-202">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SampleString {
// Required method
fn <a href="#tymethod.append_string" class="fn">append_string</a>&lt;R: <a class="trait" href="../trait.Rng.html" title="trait rand::Rng">Rng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>,
string: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
);
// Provided method
fn <a href="#method.sample_string" class="fn">sample_string</a>&lt;R: <a class="trait" href="../trait.Rng.html" title="trait rand::Rng">Rng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;self, rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>, len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Sample or extend a <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String"><code>String</code></a></p>
<p>Helper methods to extend a <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String"><code>String</code></a> or sample a new <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String"><code>String</code></a>.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.append_string" class="method"><a class="src rightside" href="../../src/rand/distr/distribution.rs.html#189">Source</a><h4 class="code-header">fn <a href="#tymethod.append_string" class="fn">append_string</a>&lt;R: <a class="trait" href="../trait.Rng.html" title="trait rand::Rng">Rng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(
&amp;self,
rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>,
string: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>,
)</h4></section></summary><div class="docblock"><p>Append <code>len</code> random chars to <code>string</code></p>
<p>Note: implementations may leave <code>string</code> with excess capacity. If this
is undesirable, consider calling <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html#method.shrink_to_fit" title="method alloc::string::String::shrink_to_fit"><code>String::shrink_to_fit</code></a> after this
method.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.sample_string" class="method"><a class="src rightside" href="../../src/rand/distr/distribution.rs.html#197-201">Source</a><h4 class="code-header">fn <a href="#method.sample_string" class="fn">sample_string</a>&lt;R: <a class="trait" href="../trait.Rng.html" title="trait rand::Rng">Rng</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt;(&amp;self, rng: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;mut R</a>, len: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Generate a <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String"><code>String</code></a> of <code>len</code> random chars</p>
<p>Note: implementations may leave the string with excess capacity. If this
is undesirable, consider calling <a href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html#method.shrink_to_fit" title="method alloc::string::String::shrink_to_fit"><code>String::shrink_to_fit</code></a> after this
method.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.93.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-SampleString-for-Choose%3C'_,+char%3E" class="impl"><a class="src rightside" href="../../src/rand/distr/slice.rs.html#122-153">Source</a><a href="#impl-SampleString-for-Choose%3C'_,+char%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">SampleString</a> for <a class="struct" href="slice/struct.Choose.html" title="struct rand::distr::slice::Choose">Choose</a>&lt;'_, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.char.html">char</a>&gt;</h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span></section><section id="impl-SampleString-for-Alphabetic" class="impl"><a class="src rightside" href="../../src/rand/distr/other.rs.html#183-194">Source</a><a href="#impl-SampleString-for-Alphabetic" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">SampleString</a> for <a class="struct" href="struct.Alphabetic.html" title="struct rand::distr::Alphabetic">Alphabetic</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span></section><section id="impl-SampleString-for-Alphanumeric" class="impl"><a class="src rightside" href="../../src/rand/distr/other.rs.html#168-180">Source</a><a href="#impl-SampleString-for-Alphanumeric" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">SampleString</a> for <a class="struct" href="struct.Alphanumeric.html" title="struct rand::distr::Alphanumeric">Alphanumeric</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span></section><section id="impl-SampleString-for-StandardUniform" class="impl"><a class="src rightside" href="../../src/rand/distr/other.rs.html#127-135">Source</a><a href="#impl-SampleString-for-StandardUniform" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">SampleString</a> for <a class="struct" href="struct.StandardUniform.html" title="struct rand::distr::StandardUniform">StandardUniform</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span></section><section id="impl-SampleString-for-Uniform%3Cchar%3E" class="impl"><a class="src rightside" href="../../src/rand/distr/uniform_other.rs.html#94-111">Source</a><a href="#impl-SampleString-for-Uniform%3Cchar%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.SampleString.html" title="trait rand::distr::SampleString">SampleString</a> for <a class="struct" href="struct.Uniform.html" title="struct rand::distr::Uniform">Uniform</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.char.html">char</a>&gt;</h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>alloc</code></strong> only.</div></span></section></div><script src="../../trait.impl/rand/distr/distribution/trait.SampleString.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -0,0 +1,70 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A distribution uniformly sampling numbers within a given range."><title>rand::distr::uniform - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module uniform</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module uniform</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-usage" title="Example usage">Example usage</a></li><li><a href="#extending-uniform-to-support-a-custom-type" title="Extending `Uniform` to support a custom type">Extending <code>Uniform</code> to support a custom type</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In rand::<wbr>distr</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">rand</a>::<wbr><a href="../index.html">distr</a></div><h1>Module <span>uniform</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/rand/distr/uniform.rs.html#10-622">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A distribution uniformly sampling numbers within a given range.</p>
<p><a href="../struct.Uniform.html" title="struct rand::distr::Uniform"><code>Uniform</code></a> is the standard distribution to sample uniformly from a range;
e.g. <code>Uniform::new_inclusive(1, 6).unwrap()</code> can sample integers from 1 to 6, like a
standard die. <a href="../../trait.Rng.html#method.random_range" title="method rand::Rng::random_range"><code>Rng::random_range</code></a> is implemented over <a href="../struct.Uniform.html" title="struct rand::distr::Uniform"><code>Uniform</code></a>.</p>
<h2 id="example-usage"><a class="doc-anchor" href="#example-usage">§</a>Example usage</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>rand::Rng;
<span class="kw">use </span>rand::distr::Uniform;
<span class="kw">let </span><span class="kw-2">mut </span>rng = rand::rng();
<span class="kw">let </span>side = Uniform::new(-<span class="number">10.0</span>, <span class="number">10.0</span>).unwrap();
<span class="comment">// sample between 1 and 10 points
</span><span class="kw">for _ in </span><span class="number">0</span>..rng.random_range(<span class="number">1</span>..=<span class="number">10</span>) {
<span class="comment">// sample a point from the square with sides -10 - 10 in two dimensions
</span><span class="kw">let </span>(x, y) = (rng.sample(side), rng.sample(side));
<span class="macro">println!</span>(<span class="string">"Point: {}, {}"</span>, x, y);
}</code></pre></div><h2 id="extending-uniform-to-support-a-custom-type"><a class="doc-anchor" href="#extending-uniform-to-support-a-custom-type">§</a>Extending <code>Uniform</code> to support a custom type</h2>
<p>To extend <a href="../struct.Uniform.html" title="struct rand::distr::Uniform"><code>Uniform</code></a> to support your own types, write a back-end which
implements the <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> trait, then implement the <a href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform"><code>SampleUniform</code></a>
helper trait to “register” your back-end. See the <code>MyF32</code> example below.</p>
<p>At a minimum, the back-end needs to store any parameters needed for sampling
(e.g. the target range) and implement <code>new</code>, <code>new_inclusive</code> and <code>sample</code>.
Those methods should include an assertion to check the range is valid (i.e.
<code>low &lt; high</code>). The example below merely wraps another back-end.</p>
<p>The <code>new</code>, <code>new_inclusive</code>, <code>sample_single</code> and <code>sample_single_inclusive</code>
functions use arguments of
type <code>SampleBorrow&lt;X&gt;</code> to support passing in values by reference or
by value. In the implementation of these functions, you can choose to
simply use the reference returned by <a href="trait.SampleBorrow.html#tymethod.borrow" title="method rand::distr::uniform::SampleBorrow::borrow"><code>SampleBorrow::borrow</code></a>, or you can choose
to copy or clone the value, whatever is appropriate for your type.</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">use </span>rand::distr::uniform::{Uniform, SampleUniform,
UniformSampler, UniformFloat, SampleBorrow, Error};
<span class="kw">struct </span>MyF32(f32);
<span class="attr">#[derive(Clone, Copy, Debug)]
</span><span class="kw">struct </span>UniformMyF32(UniformFloat&lt;f32&gt;);
<span class="kw">impl </span>UniformSampler <span class="kw">for </span>UniformMyF32 {
<span class="kw">type </span>X = MyF32;
<span class="kw">fn </span>new&lt;B1, B2&gt;(low: B1, high: B2) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, Error&gt;
<span class="kw">where </span>B1: SampleBorrow&lt;<span class="self">Self</span>::X&gt; + Sized,
B2: SampleBorrow&lt;<span class="self">Self</span>::X&gt; + Sized
{
UniformFloat::&lt;f32&gt;::new(low.borrow().<span class="number">0</span>, high.borrow().<span class="number">0</span>).map(UniformMyF32)
}
<span class="kw">fn </span>new_inclusive&lt;B1, B2&gt;(low: B1, high: B2) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, Error&gt;
<span class="kw">where </span>B1: SampleBorrow&lt;<span class="self">Self</span>::X&gt; + Sized,
B2: SampleBorrow&lt;<span class="self">Self</span>::X&gt; + Sized
{
UniformFloat::&lt;f32&gt;::new_inclusive(low.borrow().<span class="number">0</span>, high.borrow().<span class="number">0</span>).map(UniformMyF32)
}
<span class="kw">fn </span>sample&lt;R: Rng + <span class="question-mark">?</span>Sized&gt;(<span class="kw-2">&amp;</span><span class="self">self</span>, rng: <span class="kw-2">&amp;mut </span>R) -&gt; <span class="self">Self</span>::X {
MyF32(<span class="self">self</span>.<span class="number">0</span>.sample(rng))
}
}
<span class="kw">impl </span>SampleUniform <span class="kw">for </span>MyF32 {
<span class="kw">type </span>Sampler = UniformMyF32;
}
<span class="kw">let </span>(low, high) = (MyF32(<span class="number">17.0f32</span>), MyF32(<span class="number">22.0f32</span>));
<span class="kw">let </span>uniform = Uniform::new(low, high).unwrap();
<span class="kw">let </span>x = uniform.sample(<span class="kw-2">&amp;mut </span>rand::rng());</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Uniform.html" title="struct rand::distr::uniform::Uniform">Uniform</a></dt><dd>Sample values uniformly between two bounds.</dd><dt><a class="struct" href="struct.UniformChar.html" title="struct rand::distr::uniform::UniformChar">Uniform<wbr>Char</a></dt><dd>The back-end implementing <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for <code>char</code>.</dd><dt><a class="struct" href="struct.UniformDuration.html" title="struct rand::distr::uniform::UniformDuration">Uniform<wbr>Duration</a></dt><dd>The back-end implementing <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for <code>Duration</code>.</dd><dt><a class="struct" href="struct.UniformFloat.html" title="struct rand::distr::uniform::UniformFloat">Uniform<wbr>Float</a></dt><dd>The back-end implementing <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for floating-point types.</dd><dt><a class="struct" href="struct.UniformInt.html" title="struct rand::distr::uniform::UniformInt">Uniform<wbr>Int</a></dt><dd>The back-end implementing <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for integer types.</dd><dt><a class="struct" href="struct.UniformUsize.html" title="struct rand::distr::uniform::UniformUsize">Uniform<wbr>Usize</a></dt><dd>The back-end implementing <a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for <code>usize</code>.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Error.html" title="enum rand::distr::uniform::Error">Error</a></dt><dd>Error type returned from <a href="../struct.Uniform.html#method.new" title="associated function rand::distr::Uniform::new"><code>Uniform::new</code></a> and <code>new_inclusive</code>.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.SampleBorrow.html" title="trait rand::distr::uniform::SampleBorrow">Sample<wbr>Borrow</a></dt><dd>Helper trait similar to <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow"><code>Borrow</code></a> but implemented
only for <a href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform"><code>SampleUniform</code></a> and references to <a href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform"><code>SampleUniform</code></a>
in order to resolve ambiguity issues.</dd><dt><a class="trait" href="trait.SampleRange.html" title="trait rand::distr::uniform::SampleRange">Sample<wbr>Range</a></dt><dd>Range that supports generating a single sample efficiently.</dd><dt><a class="trait" href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform">Sample<wbr>Uniform</a></dt><dd>Helper trait for creating objects using the correct implementation of
<a href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler"><code>UniformSampler</code></a> for the sampling type.</dd><dt><a class="trait" href="trait.UniformSampler.html" title="trait rand::distr::uniform::UniformSampler">Uniform<wbr>Sampler</a></dt><dd>Helper trait handling actual uniform sampling.</dd></dl></section></div></main></body></html>

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["Error"],"struct":["Uniform","UniformChar","UniformDuration","UniformFloat","UniformInt","UniformUsize"],"trait":["SampleBorrow","SampleRange","SampleUniform","UniformSampler"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Helper trait similar to `Borrow` but implemented only for `SampleUniform` and references to `SampleUniform` in order to resolve ambiguity issues."><title>SampleBorrow in rand::distr::uniform - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">SampleBorrow</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Sample<wbr>Borrow</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.borrow" title="borrow">borrow</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-SampleBorrow%3CBorrowed%3E-for-%26Borrowed" title="&#38;Borrowed">&#38;Borrowed</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In rand::<wbr>distr::<wbr>uniform</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">rand</a>::<wbr><a href="../index.html">distr</a>::<wbr><a href="index.html">uniform</a></div><h1>Trait <span class="trait">Sample<wbr>Borrow</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/rand/distr/uniform.rs.html#393-398">Source</a> </span></div><pre class="rust item-decl"><code>pub trait SampleBorrow&lt;Borrowed&gt; {
// Required method
fn <a href="#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Borrowed</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Helper trait similar to <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow"><code>Borrow</code></a> but implemented
only for <a href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform"><code>SampleUniform</code></a> and references to <a href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform"><code>SampleUniform</code></a>
in order to resolve ambiguity issues.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.borrow" class="method"><a class="src rightside" href="../../../src/rand/distr/uniform.rs.html#397">Source</a><h4 class="code-header">fn <a href="#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Borrowed</a></h4></section></summary><div class="docblock"><p>Immutably borrows from an owned value. See <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" title="method core::borrow::Borrow::borrow"><code>Borrow::borrow</code></a></p>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-SampleBorrow%3CBorrowed%3E-for-%26Borrowed" class="impl"><a class="src rightside" href="../../../src/rand/distr/uniform.rs.html#408-416">Source</a><a href="#impl-SampleBorrow%3CBorrowed%3E-for-%26Borrowed" class="anchor">§</a><h3 class="code-header">impl&lt;Borrowed&gt; <a class="trait" href="trait.SampleBorrow.html" title="trait rand::distr::uniform::SampleBorrow">SampleBorrow</a>&lt;Borrowed&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Borrowed</a><div class="where">where
Borrowed: <a class="trait" href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform">SampleUniform</a>,</div></h3></section></summary><div class="impl-items"><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="../../../src/rand/distr/uniform.rs.html#413-415">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&amp;Borrowed</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-SampleBorrow%3CBorrowed%3E-for-Borrowed" class="impl"><a class="src rightside" href="../../../src/rand/distr/uniform.rs.html#399-407">Source</a><a href="#impl-SampleBorrow%3CBorrowed%3E-for-Borrowed" class="anchor">§</a><h3 class="code-header">impl&lt;Borrowed&gt; <a class="trait" href="trait.SampleBorrow.html" title="trait rand::distr::uniform::SampleBorrow">SampleBorrow</a>&lt;Borrowed&gt; for Borrowed<div class="where">where
Borrowed: <a class="trait" href="trait.SampleUniform.html" title="trait rand::distr::uniform::SampleUniform">SampleUniform</a>,</div></h3></section></div><script src="../../../trait.impl/rand/distr/uniform/trait.SampleBorrow.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
<!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="Weighted (index) sampling"><title>rand::distr::weighted - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="rand" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module weighted</a></h2></rustdoc-topbar><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.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module weighted</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In rand::<wbr>distr</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">rand</a>::<wbr><a href="../index.html">distr</a></div><h1>Module <span>weighted</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/rand/distr/weighted/mod.rs.html#9-115">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Weighted (index) sampling</p>
<p>Primarily, this module houses the <a href="struct.WeightedIndex.html" title="struct rand::distr::weighted::WeightedIndex"><code>WeightedIndex</code></a> distribution.
See also <a href="https://docs.rs/rand_distr/latest/rand_distr/weighted/index.html"><code>rand_distr::weighted</code></a> for alternative implementations supporting
potentially-faster sampling or a more easily modifiable tree structure.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.WeightedIndex.html" title="struct rand::distr::weighted::WeightedIndex">Weighted<wbr>Index</a></dt><dd>A distribution using weighted sampling of discrete items.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Error.html" title="enum rand::distr::weighted::Error">Error</a></dt><dd>Invalid weight errors</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Weight.html" title="trait rand::distr::weighted::Weight">Weight</a></dt><dd>Bounds on a weight</dd></dl></section></div></main></body></html>

View File

@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"enum":["Error"],"struct":["WeightedIndex"],"trait":["Weight"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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