📄 datastructures.random.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Sun Sep 27 09:53:40 EDT 1998
-->
<title>
Class DataStructures.Random
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-DataStructures.html">This Package</a> <a href="DataStructures.QueueAr.html">Previous</a> <a href="DataStructures.RedBlackTree.html">Next</a> <a href="Index.html">Index</a> </pre>
<hr>
<h1>
Class DataStructures.Random
</h1>
<pre>
java.lang.Object
|
+----DataStructures.Random
</pre>
<hr>
<dl>
<dt>public class <b>Random</b>
<dt>extends Object</dl>
Random number class, using a 31-bitlinear congruential generator.Note that java.util contains a class Random,so watch out for name conflicts.
<p>
<hr>
<a name="index"></a><h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt><img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#Random()"><b>Random</b></a>()
<dd>Construct this Random object withinitial state obtained from system clock.
<dt><img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#Random(int)"><b>Random</b></a>(int)
<dd>Construct this Random object withspecified initial state.
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt><img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#main(java.lang.String[])"><b>main</b></a>(String[])
<dd>
<dt><img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#permute(java.lang.Object[])"><b>permute</b></a>(Object[])
<dd>Randomly rearrange an array.
<dt><img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#random0_1()"><b>random0_1</b></a>()
<dd>Return a pseudorandom double in the open range 0..1and change the internal state.
<dt><img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#randomInt()"><b>randomInt</b></a>()
<dd>Return a pseudorandom int, and change theinternal state.
<dt><img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#randomInt(int, int)"><b>randomInt</b></a>(int, int)
<dd>Return an int in the closed range [low,high], andchange the internal state.
<dt><img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#randomIntWRONG()"><b>randomIntWRONG</b></a>()
<dd>Return a pseudorandom int, and change theinternal state.
<dt><img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#randomLong(long, long)"><b>randomLong</b></a>(long, long)
<dd>Return an long in the closed range [low,high], andchange the internal state.
</dl>
<a name="constructors"></a><h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Random"></a><a name="Random"></a><a name="Random()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o ">
</a><b>Random</b>
<pre>
public Random()</pre>
<dl>
<dd>Construct this Random object withinitial state obtained from system clock.
<p>
</dl>
<a name="Random"></a><a name="Random(int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o ">
</a><b>Random</b>
<pre>
public Random(int initialValue)</pre>
<dl>
<dd>Construct this Random object withspecified initial state.
<p>
<dd><dl>
<dt><b>Parameters:</b>
<dd>initialValue - the initial state.
</dl>
</dd>
</dl>
<a name="methods"></a><h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="randomInt"></a><a name="randomInt()"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">
</a><b>randomInt</b>
<pre>
public int randomInt()</pre>
<dl>
<dd>Return a pseudorandom int, and change theinternal state.
<p>
<dd><dl>
<dt><b>Returns:</b>
<dd>the pseudorandom int.</dl>
</dd>
</dl>
<a name="randomIntWRONG"></a><a name="randomIntWRONG()"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">
</a><b>randomIntWRONG</b>
<pre>
public int randomIntWRONG()</pre>
<dl>
<dd>Return a pseudorandom int, and change theinternal state. DOES NOT WORK.
<p>
<dd><dl>
<dt><b>Returns:</b>
<dd>the pseudorandom int.</dl>
</dd>
</dl>
<a name="random0_1"></a><a name="random0_1()"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">
</a><b>random0_1</b>
<pre>
public double random0_1()</pre>
<dl>
<dd>Return a pseudorandom double in the open range 0..1and change the internal state.
<p>
<dd><dl>
<dt><b>Returns:</b>
<dd>the pseudorandom double.</dl>
</dd>
</dl>
<a name="randomInt"></a><a name="randomInt(int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">
</a><b>randomInt</b>
<pre>
public int randomInt(int low, int high)</pre>
<dl>
<dd>Return an int in the closed range [low,high], andchange the internal state.
<p>
<dd><dl>
<dt><b>Parameters:</b>
<dd>low - the minimum value returned.
<dd>high - the maximum value returned.
<dt><b>Returns:</b>
<dd>the pseudorandom int.</dl>
</dd>
</dl>
<a name="randomLong"></a><a name="randomLong(long, long)"><img src="images/red-ball.gif" width=12 height=12 alt=" o ">
</a><b>randomLong</b>
<pre>
public long randomLong(long low, long high)</pre>
<dl>
<dd>Return an long in the closed range [low,high], andchange the internal state.
<p>
<dd><dl>
<dt><b>Parameters:</b>
<dd>low - the minimum value returned.
<dd>high - the maximum value returned.
<dt><b>Returns:</b>
<dd>the pseudorandom long.</dl>
</dd>
</dl>
<a name="permute"></a><a name="permute(java.lang.Object[])"><img src="images/green-ball.gif" width=12 height=12 alt=" o ">
</a><b>permute</b>
<pre>
public static final void permute(Object[] a)</pre>
<dl>
<dd>Randomly rearrange an array.The random numbers used depend on the time and day.
<p>
<dd><dl>
<dt><b>Parameters:</b>
<dd>a - the array.
</dl>
</dd>
</dl>
<a name="main"></a><a name="main(java.lang.String[])"><img src="images/green-ball.gif" width=12 height=12 alt=" o ">
</a><b>main</b>
<pre>
public static void main(String[] args)</pre>
<dl>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-DataStructures.html">This Package</a> <a href="DataStructures.QueueAr.html">Previous</a> <a href="DataStructures.RedBlackTree.html">Next</a> <a href="Index.html">Index</a> </pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -