337 lines
No EOL
16 KiB
HTML
337 lines
No EOL
16 KiB
HTML
<!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="../main.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">☰</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="#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">
|
||
</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'>−</span>]
|
||
</a>
|
||
</span><a class='srclink' href='../src/rand/lib.rs.html#11-297' title='goto source code'>[src]</a></span></h1>
|
||
<div class='docblock'><p>Utilities for random number generation</p>
|
||
<p>This release is a compatibility wrapper around <code>rand</code> version 0.4. Please
|
||
upgrade.</p>
|
||
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="chacha/index.html"
|
||
title='mod rand::chacha'>chacha</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The ChaCha random number generator.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="distributions/index.html"
|
||
title='mod rand::distributions'>distributions</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Sampling from random distributions.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="isaac/index.html"
|
||
title='mod rand::isaac'>isaac</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The ISAAC random number generator.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="os/index.html"
|
||
title='mod rand::os'>os</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Interfaces to the operating system provided random number
|
||
generators.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="read/index.html"
|
||
title='mod rand::read'>read</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A wrapper around any Read to treat it as an RNG.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="mod" href="reseeding/index.html"
|
||
title='mod rand::reseeding'>reseeding</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A wrapper around another RNG that reseeds it after it
|
||
generates a certain number of random bytes.</p>
|
||
|
||
</td>
|
||
</tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.AsciiGenerator.html"
|
||
title='struct rand::AsciiGenerator'>AsciiGenerator</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Iterator which will continuously generate random ascii characters.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.ChaChaRng.html"
|
||
title='struct rand::ChaChaRng'>ChaChaRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator that uses the ChaCha20 algorithm [1].</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.Closed01.html"
|
||
title='struct rand::Closed01'>Closed01</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A wrapper for generating floating point numbers uniformly in the
|
||
closed interval <code>[0,1]</code> (including both endpoints).</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.Generator.html"
|
||
title='struct rand::Generator'>Generator</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Iterator which will generate a stream of random items.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.Isaac64Rng.html"
|
||
title='struct rand::Isaac64Rng'>Isaac64Rng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator that uses ISAAC-64[1], the 64-bit
|
||
variant of the ISAAC algorithm.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.IsaacRng.html"
|
||
title='struct rand::IsaacRng'>IsaacRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator that uses the ISAAC algorithm[1].</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.Open01.html"
|
||
title='struct rand::Open01'>Open01</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A wrapper for generating floating point numbers uniformly in the
|
||
open interval <code>(0,1)</code> (not including either endpoint).</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.OsRng.html"
|
||
title='struct rand::OsRng'>OsRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator that retrieves randomness straight from
|
||
the operating system. Platform sources:</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.StdRng.html"
|
||
title='struct rand::StdRng'>StdRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The standard RNG. This is designed to be efficient on the current
|
||
platform.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.ThreadRng.html"
|
||
title='struct rand::ThreadRng'>ThreadRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The thread-local RNG.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.XorShiftRng.html"
|
||
title='struct rand::XorShiftRng'>XorShiftRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>An Xorshift[1] random number
|
||
generator.</p>
|
||
|
||
</td>
|
||
</tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="trait" href="trait.Rand.html"
|
||
title='trait rand::Rand'>Rand</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A type that can be randomly generated using an <code>Rng</code>.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="trait" href="trait.Rng.html"
|
||
title='trait rand::Rng'>Rng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="trait" href="trait.SeedableRng.html"
|
||
title='trait rand::SeedableRng'>SeedableRng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>A random number generator that can be explicitly seeded to produce
|
||
the same stream of randomness multiple times.</p>
|
||
|
||
</td>
|
||
</tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="fn" href="fn.random.html"
|
||
title='fn rand::random'>random</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Generates a random value using the thread-local random number generator.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="fn" href="fn.sample.html"
|
||
title='fn rand::sample'>sample</a></td>
|
||
<td class='docblock-short'>
|
||
[<div class='stab deprecated'>Deprecated</div>] <p>DEPRECATED: use <code>seq::sample_iter</code> instead.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="fn" href="fn.thread_rng.html"
|
||
title='fn rand::thread_rng'>thread_rng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>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>.</p>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="fn" href="fn.weak_rng.html"
|
||
title='fn rand::weak_rng'>weak_rng</a></td>
|
||
<td class='docblock-short'>
|
||
<p>Create a weak random number generator with a default algorithm and seed.</p>
|
||
|
||
</td>
|
||
</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>⏎</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>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../";
|
||
window.currentCrate = "rand";
|
||
</script>
|
||
<script src="../main.js"></script>
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |