653 lines
28 KiB
HTML
653 lines
28 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:11 EDT 2016 -->
|
|
<title>Random (Parallel Java 2 Library Documentation)</title>
|
|
<meta name="date" content="2016-04-06">
|
|
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="Random (Parallel Java 2 Library Documentation)";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar_top">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Random.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/util/PriorityQueue.Item.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/RandomSubset.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/util/Random.html" target="_top">Frames</a></li>
|
|
<li><a href="Random.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">edu.rit.util</div>
|
|
<h2 title="Class Random" class="title">Class Random</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>edu.rit.util.Random</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="strong">Random</span>
|
|
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
|
|
implements <a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></pre>
|
|
<div class="block">Class Random provides a pseudorandom number generator (PRNG) designed for use
|
|
in parallel programming.
|
|
<P>
|
|
Class Random generates random numbers by hashing successive counter
|
|
values. The seed initializes the counter. The hash function is defined in W.
|
|
Press et al., <I>Numerical Recipes: The Art of Scientific Computing, Third
|
|
Edition</I> (Cambridge University Press, 2007), page 352. The hash function
|
|
applied to the counter value <I>i</I> is:
|
|
<P>
|
|
<I>x</I> := 3935559000370003845 * <I>i</I> + 2691343689449507681 (mod 2<SUP>64</SUP>)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> right-shift 21)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> left-shift 37)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> right-shift 4)
|
|
<BR><I>x</I> := 4768777513237032717 * <I>x</I> (mod 2<SUP>64</SUP>)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> left-shift 20)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> right-shift 41)
|
|
<BR><I>x</I> := <I>x</I> xor (<I>x</I> left-shift 5)
|
|
<BR>Return <I>x</I>
|
|
<P>
|
|
(The shift and arithmetic operations are all performed on unsigned 64-bit
|
|
numbers.)
|
|
<P>
|
|
In addition to the usual methods for generating random numbers of various
|
|
types, class Random provides efficient <I>skip</I> operations. The <a href="../../../edu/rit/util/Random.html#skip(long)"><code>skip()</code></a> method skips the PRNG ahead a certain amount without
|
|
actually generating the skipped-over random numbers. The <a href="../../../edu/rit/util/Random.html#skipTo(long)"><code>skipTo()</code></a> method puts the PRNG back to its most recently seeded state, then
|
|
skips the PRNG ahead a certain amount.
|
|
<P>
|
|
An instance of class Random can be serialized; for example, to checkpoint the
|
|
state of the PRNG into a file and restore its state later.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a href="../../../edu/rit/util/Random.html#Random(long)">Random</a></strong>(long seed)</code>
|
|
<div class="block">Construct a new PRNG with the given seed.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextBigInteger(int)">nextBigInteger</a></strong>(int n)</code>
|
|
<div class="block">Return a big integer value from the next pseudorandom values in this
|
|
PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextBoolean()">nextBoolean</a></strong>()</code>
|
|
<div class="block">Return a Boolean value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>byte</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextByte()">nextByte</a></strong>()</code>
|
|
<div class="block">Return a byte value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>char</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextCharacter()">nextCharacter</a></strong>()</code>
|
|
<div class="block">Return a character value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextDouble()">nextDouble</a></strong>()</code>
|
|
<div class="block">Return a double precision floating point value from the next
|
|
pseudorandom value in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextFloat()">nextFloat</a></strong>()</code>
|
|
<div class="block">Return a single precision floating point value from the next
|
|
pseudorandom value in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextInt(int)">nextInt</a></strong>(int n)</code>
|
|
<div class="block">Return an integer value in the given range from the next pseudorandom
|
|
value in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextInteger()">nextInteger</a></strong>()</code>
|
|
<div class="block">Return an integer value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextLong()">nextLong</a></strong>()</code>
|
|
<div class="block">Return a long value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>short</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextShort()">nextShort</a></strong>()</code>
|
|
<div class="block">Return a short value from the next pseudorandom value in this PRNG's
|
|
sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextUnsignedByte()">nextUnsignedByte</a></strong>()</code>
|
|
<div class="block">Return an unsigned byte value from the next pseudorandom value in this
|
|
PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#nextUnsignedShort()">nextUnsignedShort</a></strong>()</code>
|
|
<div class="block">Return an unsigned short value from the next pseudorandom value in this
|
|
PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#readIn(edu.rit.io.InStream)">readIn</a></strong>(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a> in)</code>
|
|
<div class="block">Read this object's fields from the given in stream.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#setSeed(long)">setSeed</a></strong>(long seed)</code>
|
|
<div class="block">Set this PRNG's seed.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#skip()">skip</a></strong>()</code>
|
|
<div class="block">Skip one position ahead in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#skip(long)">skip</a></strong>(long skip)</code>
|
|
<div class="block">Skip the given number of positions ahead in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#skipTo(long)">skipTo</a></strong>(long skip)</code>
|
|
<div class="block">Skip to the given position in this PRNG's sequence.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Random.html#writeOut(edu.rit.io.OutStream)">writeOut</a></strong>(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a> out)</code>
|
|
<div class="block">Write this object's fields to the given out stream.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
|
|
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="Random(long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>Random</h4>
|
|
<pre>public Random(long seed)</pre>
|
|
<div class="block">Construct a new PRNG with the given seed. Any seed value is allowed.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>seed</code> - Seed.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="setSeed(long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setSeed</h4>
|
|
<pre>public void setSeed(long seed)</pre>
|
|
<div class="block">Set this PRNG's seed. Any seed value is allowed.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>seed</code> - Seed.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="skip()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>skip</h4>
|
|
<pre>public void skip()</pre>
|
|
<div class="block">Skip one position ahead in this PRNG's sequence.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="skip(long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>skip</h4>
|
|
<pre>public void skip(long skip)</pre>
|
|
<div class="block">Skip the given number of positions ahead in this PRNG's sequence. If
|
|
<TT>skip</TT> < 0, the <TT>skip()</TT> method does nothing.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>skip</code> - Number of positions to skip.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="skipTo(long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>skipTo</h4>
|
|
<pre>public void skipTo(long skip)</pre>
|
|
<div class="block">Skip to the given position in this PRNG's sequence. If <TT>skip</TT> <
|
|
0, the <TT>skipTo()</TT> method does nothing.
|
|
<P>
|
|
The <TT>skipTo()</TT> method, in effect, puts this PRNG back to its most
|
|
recently seeded state, then skips this PRNG ahead by <TT>skip</TT>
|
|
positions.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>skip</code> - Position to which to skip.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextBoolean()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextBoolean</h4>
|
|
<pre>public boolean nextBoolean()</pre>
|
|
<div class="block">Return a Boolean value from the next pseudorandom value in this PRNG's
|
|
sequence. With a probability of 0.5 <TT>true</TT> is returned, with a
|
|
probability of 0.5 <TT>false</TT> is returned.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Boolean value.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextByte()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextByte</h4>
|
|
<pre>public byte nextByte()</pre>
|
|
<div class="block">Return a byte value from the next pseudorandom value in this PRNG's
|
|
sequence. Each value in the range −128 through 127 is returned with
|
|
a probability of 1/2<SUP>8</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Byte value in the range −128 through 127 inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextUnsignedByte()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextUnsignedByte</h4>
|
|
<pre>public int nextUnsignedByte()</pre>
|
|
<div class="block">Return an unsigned byte value from the next pseudorandom value in this
|
|
PRNG's sequence. Each value in the range 0 through 255 is returned with a
|
|
probability of 1/2<SUP>8</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Unsigned byte value (as an <TT>int</TT>) in the range 0 through
|
|
255 inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextCharacter()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextCharacter</h4>
|
|
<pre>public char nextCharacter()</pre>
|
|
<div class="block">Return a character value from the next pseudorandom value in this PRNG's
|
|
sequence. Each value in the range <TT>'\u0000'</TT> through
|
|
<TT>'\uFFFF'</TT> is returned with a probability of 1/2<SUP>16</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Character value in the range <TT>'\u0000'</TT> through
|
|
<TT>'\uFFFF'</TT> inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextShort()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextShort</h4>
|
|
<pre>public short nextShort()</pre>
|
|
<div class="block">Return a short value from the next pseudorandom value in this PRNG's
|
|
sequence. Each value in the range −32768 through 32767 is returned
|
|
with a probability of 1/2<SUP>16</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Short value in the range −32768 through 32767 inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextUnsignedShort()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextUnsignedShort</h4>
|
|
<pre>public int nextUnsignedShort()</pre>
|
|
<div class="block">Return an unsigned short value from the next pseudorandom value in this
|
|
PRNG's sequence. Each value in the range 0 through 65535 is returned with
|
|
a probability of 1/2<SUP>16</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Unsigned short value (as an <TT>int</TT>) in the range 0 through
|
|
65535 inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextInteger()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextInteger</h4>
|
|
<pre>public int nextInteger()</pre>
|
|
<div class="block">Return an integer value from the next pseudorandom value in this PRNG's
|
|
sequence. Each value in the range −2147483648 through 2147483647 is
|
|
returned with a probability of 1/2<SUP>32</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Integer value in the range −2147483648 through 2147483647
|
|
inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextInt(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextInt</h4>
|
|
<pre>public int nextInt(int n)</pre>
|
|
<div class="block">Return an integer value in the given range from the next pseudorandom
|
|
value in this PRNG's sequence. Each value in the range 0 through
|
|
<I>N</I>−1 is returned with a probability of 1/<I>N</I>.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>n</code> - Range of values to return.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Integer value in the range 0 through <I>N</I>−1 inclusive.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <I>N</I> ≤ 0.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextLong()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextLong</h4>
|
|
<pre>public long nextLong()</pre>
|
|
<div class="block">Return a long value from the next pseudorandom value in this PRNG's
|
|
sequence. Each value in the range −9223372036854775808 through
|
|
9223372036854775807 is returned with a probability of 1/2<SUP>64</SUP>.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Long value in the range −9223372036854775808 through
|
|
9223372036854775807 inclusive.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextFloat()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextFloat</h4>
|
|
<pre>public float nextFloat()</pre>
|
|
<div class="block">Return a single precision floating point value from the next
|
|
pseudorandom value in this PRNG's sequence. The returned numbers have a
|
|
uniform distribution in the range 0.0 (inclusive) to 1.0 (exclusive).</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Float value.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextDouble()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextDouble</h4>
|
|
<pre>public double nextDouble()</pre>
|
|
<div class="block">Return a double precision floating point value from the next
|
|
pseudorandom value in this PRNG's sequence. The returned numbers have a
|
|
uniform distribution in the range 0.0 (inclusive) to 1.0 (exclusive).</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Double value.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="nextBigInteger(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>nextBigInteger</h4>
|
|
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> nextBigInteger(int n)</pre>
|
|
<div class="block">Return a big integer value from the next pseudorandom values in this
|
|
PRNG's sequence. The returned numbers have a uniform distribution in the
|
|
range 0 (inclusive) through 2<SUP><I>n</I></SUP>−1 (inclusive).</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>n</code> - Bit size of big integer.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Big integer.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <I>n</I> < 0.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="writeOut(edu.rit.io.OutStream)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>writeOut</h4>
|
|
<pre>public void writeOut(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a> out)
|
|
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
|
|
<div class="block">Write this object's fields to the given out stream.</div>
|
|
<dl>
|
|
<dt><strong>Specified by:</strong></dt>
|
|
<dd><code><a href="../../../edu/rit/io/Streamable.html#writeOut(edu.rit.io.OutStream)">writeOut</a></code> in interface <code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
|
|
<dt><span class="strong">Parameters:</span></dt><dd><code>out</code> - Out stream.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="readIn(edu.rit.io.InStream)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>readIn</h4>
|
|
<pre>public void readIn(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a> in)
|
|
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
|
|
<div class="block">Read this object's fields from the given in stream.</div>
|
|
<dl>
|
|
<dt><strong>Specified by:</strong></dt>
|
|
<dd><code><a href="../../../edu/rit/io/Streamable.html#readIn(edu.rit.io.InStream)">readIn</a></code> in interface <code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
|
|
<dt><span class="strong">Parameters:</span></dt><dd><code>in</code> - In stream.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar_bottom">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Random.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/util/PriorityQueue.Item.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/RandomSubset.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/util/Random.html" target="_top">Frames</a></li>
|
|
<li><a href="Random.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><FONT SIZE="-2">Copyright © 2013–2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">@</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
|
|
</body>
|
|
</html>
|