2016-01-16 22:15:15 +01:00

290 lines
7.1 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>utils</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>utils</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/stringutil.html">stringutil</a></li>
<li><strong>random</strong></li>
<li><a href="../modules/noisemanager.html">noisemanager</a></li>
<li><a href="../modules/nodeutil.html">nodeutil</a></li>
<li><a href="../modules/posutil.html">posutil</a></li>
<li><a href="../modules/objectrefutil.html">objectrefutil</a></li>
<li><a href="../modules/nodeboxutil.html">nodeboxutil</a></li>
<li><a href="../modules/mapmanipulator.html">mapmanipulator</a></li>
<li><a href="../modules/fisheryates.html">fisheryates</a></li>
<li><a href="../modules/textureutil.html">textureutil</a></li>
<li><a href="../modules/blockutil.html">blockutil</a></li>
<li><a href="../modules/tango.html">tango</a></li>
<li><a href="../modules/arraymanipulator.html">arraymanipulator</a></li>
<li><a href="../modules/inventoryutil.html">inventoryutil</a></li>
<li><a href="../modules/entityutil.html">entityutil</a></li>
<li><a href="../modules/scheduler.html">scheduler</a></li>
<li><a href="../modules/blockedcache.html">blockedcache</a></li>
<li><a href="../modules/mathutil.html">mathutil</a></li>
<li><a href="../modules/log.html">log</a></li>
<li><a href="../modules/arrayutil.html">arrayutil</a></li>
<li><a href="../modules/directmapmanipulator.html">directmapmanipulator</a></li>
<li><a href="../modules/rotationutil.html">rotationutil</a></li>
<li><a href="../modules/settings.html">settings</a></li>
<li><a href="../modules/pathutil.html">pathutil</a></li>
<li><a href="../modules/wallmountedutil.html">wallmountedutil</a></li>
<li><a href="../modules/interpolate.html">interpolate</a></li>
<li><a href="../modules/transform.html">transform</a></li>
<li><a href="../modules/numberutil.html">numberutil</a></li>
<li><a href="../modules/test.html">test</a></li>
<li><a href="../modules/facedirutil.html">facedirutil</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/minetestex.html">minetestex</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/stopwatch.html">stopwatch</a></li>
<li><a href="../modules/itemutil.html">itemutil</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/tableutil.html">tableutil</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>random</code></h1>
<p>Random is a static utility that provides fast and easy access to
random numbers.</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init ()</a></td>
<td class="summary">Initializes random.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#next_bool">next_bool (chance)</a></td>
<td class="summary">Returns true or false based on the given chance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#next_float">next_float (lower_bound, upper_bound, decimal_places)</a></td>
<td class="summary">Returns a float between the given bounds.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#next_int">next_int (lower_bound, upper_bound)</a></td>
<td class="summary">Returns an int between the given bounds.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#max">max</a></td>
<td class="summary">The internal maximum value.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#min">min</a></td>
<td class="summary">The internal minimum value.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#random_provider">random_provider</a></td>
<td class="summary">The provider for random numbers.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init ()</strong>
</dt>
<dd>
Initializes random. Should not be called from the client.
</dd>
<dt>
<a name = "next_bool"></a>
<strong>next_bool (chance)</strong>
</dt>
<dd>
Returns true or false based on the given chance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">chance</span>
Optional. The "one in chance" chance to get true, defaults
to 2 (ans in "one in two").
</li>
</ul>
<h3>Returns:</h3>
<ol>
true or false based in the given chance.
</ol>
</dd>
<dt>
<a name = "next_float"></a>
<strong>next_float (lower_bound, upper_bound, decimal_places)</strong>
</dt>
<dd>
Returns a float between the given bounds.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">lower_bound</span>
Optional. The lower bound (inclusive), defaults to 0.
</li>
<li><span class="parameter">upper_bound</span>
Optional. The upper bound (inclusive), defaults to 1.
</li>
<li><span class="parameter">decimal_places</span>
Optional. To how many decimal places the resulting
float should be rounded.
</li>
</ul>
<h3>Returns:</h3>
<ol>
a float between the given bounds.
</ol>
</dd>
<dt>
<a name = "next_int"></a>
<strong>next_int (lower_bound, upper_bound)</strong>
</dt>
<dd>
Returns an int between the given bounds.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">lower_bound</span>
Optional. The lower bound (inclusive), defaults to
random.min.
</li>
<li><span class="parameter">upper_bound</span>
Optional. The upper bound (inclusive), defaults to
random.max.
</li>
</ul>
<h3>Returns:</h3>
<ol>
a integer between the given bounds.
</ol>
</dd>
</dl>
<h2><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "max"></a>
<strong>max</strong>
</dt>
<dd>
The internal maximum value.
</dd>
<dt>
<a name = "min"></a>
<strong>min</strong>
</dt>
<dd>
The internal minimum value.
</dd>
<dt>
<a name = "random_provider"></a>
<strong>random_provider</strong>
</dt>
<dd>
The provider for random numbers.
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>