<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.util.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-java.util.html">This Package</a>  <a href="java.util.PropertyResourceBundle.html#_top_">Previous</a>  <a href="java.util.ResourceBundle.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.util.Random
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.util.Random
</pre>
<hr>
<dl>
  <dt> public class <b>Random</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
  <dt> implements <a href="java.io.Serializable.html#_top_">Serializable</a>
</dl>
An instance of this class is used to generate a stream of 
 pseudorandom numbers. The class uses a 48-bit seed, which is 
 modified using a linear congruential formula. (See Donald Knuth, 
 <i>The Art of Computer Programming, Volume 2</i>, Section 3.2.1.) 
 <p>
 If two instances of <code>Random</code> are created with the same 
 seed, and the same sequence of method calls is made for each, they 
 will generate and return identical sequences of numbers. 
 <p>
 Many applications will find the <code>random</code> method in 
 class <code>Math</code> simpler to use.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.lang.Math.html#random()">random</a>
</dl>
<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> 
 Creates a new random number generator.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Random(long)"><b>Random</b></a>(long)
  <dd> 
 Creates a new random number generator using a single 
 <code>long</code> seed.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#next(int)"><b>next</b></a>(int)
  <dd>  Generates the next pseudorandom number.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextBytes(byte[])"><b>nextBytes</b></a>(byte[])
  <dd>  Generates a user specified number of random bytes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextDouble()"><b>nextDouble</b></a>()
  <dd>  Returns the next pseudorandom, uniformly distributed 
 <code>double</code> value between <code>0.0</code> and
 <code>1.0</code> from this random number generator's sequence.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextFloat()"><b>nextFloat</b></a>()
  <dd>  Returns the next pseudorandom, uniformly distributed <code>float</code>
 value between <code>0.0</code> and <code>1.0</code> from this random
 number generator's sequence.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextGaussian()"><b>nextGaussian</b></a>()
  <dd>  Returns the next pseudorandom, Gaussian ("normally") distributed
 <code>double</code> value with mean <code>0.0</code> and standard
 deviation <code>1.0</code> from this random number generator's sequence.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextInt()"><b>nextInt</b></a>()
  <dd>  Returns the next pseudorandom, uniformly distributed <code>int</code>
 value from this random number generator's sequence.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextLong()"><b>nextLong</b></a>()
  <dd>  Returns the next pseudorandom, uniformly distributed <code>long</code>
 value from this random number generator's sequence.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setSeed(long)"><b>setSeed</b></a>(long)
  <dd>  Sets the seed of this random number generator using a single 
 <code>long</code> seed.
</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()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Random</b>
<pre>
 public Random()
</pre>
<dl>
  <dd> Creates a new random number generator. Its seed is initialized to 
 a value based on the current time.
<p>
  <dd><dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.lang.System.html#currentTimeMillis()">currentTimeMillis</a>
  </dl></dd>
</dl>
<a name="Random(long)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Random</b>
<pre>
 public Random(long seed)
</pre>
<dl>
  <dd> Creates a new random number generator using a single 
 <code>long</code> seed.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> seed - the initial seed.
    <dt> <b>See Also:</b>
    <dd> <a href="#setSeed(long)">setSeed</a>
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="setSeed(long)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setSeed"><b>setSeed</b></a>
<pre>
 public synchronized void setSeed(long seed)
</pre>
<dl>
  <dd> Sets the seed of this random number generator using a single 
 <code>long</code> seed.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> seed - the initial seed.
  </dl></dd>
</dl>
<a name="next(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="next"><b>next</b></a>
<pre>
 protected synchronized int next(int bits)
</pre>
<dl>
  <dd> Generates the next pseudorandom number. Subclass should
 override this, as this is used by all other methods.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> bits - random bits
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom value from this random number generator's sequence.
  </dl></dd>
</dl>
<a name="nextBytes(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextBytes"><b>nextBytes</b></a>
<pre>
 public void nextBytes(byte bytes[])
</pre>
<dl>
  <dd> Generates a user specified number of random bytes.
<p>
</dl>
<a name="nextInt()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextInt"><b>nextInt</b></a>
<pre>
 public int nextInt()
</pre>
<dl>
  <dd> Returns the next pseudorandom, uniformly distributed <code>int</code>
 value from this random number generator's sequence.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom, uniformly distributed <code>int</code>
          value from this random number generator's sequence.
  </dl></dd>
</dl>
<a name="nextLong()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextLong"><b>nextLong</b></a>
<pre>
 public long nextLong()
</pre>
<dl>
  <dd> Returns the next pseudorandom, uniformly distributed <code>long</code>
 value from this random number generator's sequence.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom, uniformly distributed <code>long</code>
          value from this random number generator's sequence.
  </dl></dd>
</dl>
<a name="nextFloat()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextFloat"><b>nextFloat</b></a>
<pre>
 public float nextFloat()
</pre>
<dl>
  <dd> Returns the next pseudorandom, uniformly distributed <code>float</code>
 value between <code>0.0</code> and <code>1.0</code> from this random
 number generator's sequence.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom, uniformly distributed <code>float</code>
          value between <code>0.0</code> and <code>1.0</code> from this
          random number generator's sequence.
  </dl></dd>
</dl>
<a name="nextDouble()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextDouble"><b>nextDouble</b></a>
<pre>
 public double nextDouble()
</pre>
<dl>
  <dd> Returns the next pseudorandom, uniformly distributed 
 <code>double</code> value between <code>0.0</code> and
 <code>1.0</code> from this random number generator's sequence.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom, uniformly distributed
          <code>double</code> value between <code>0.0</code> and
          <code>1.0</code> from this random number generator's sequence.
  </dl></dd>
</dl>
<a name="nextGaussian()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextGaussian"><b>nextGaussian</b></a>
<pre>
 public synchronized double nextGaussian()
</pre>
<dl>
  <dd> Returns the next pseudorandom, Gaussian ("normally") distributed
 <code>double</code> value with mean <code>0.0</code> and standard
 deviation <code>1.0</code> from this random number generator's sequence.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next pseudorandom, Gaussian ("normally") distributed
          <code>double</code> value with mean <code>0.0</code> and
          standard deviation <code>1.0</code> from this random number
          generator's sequence.
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.util.html">This Package</a>  <a href="java.util.PropertyResourceBundle.html#_top_">Previous</a>  <a href="java.util.ResourceBundle.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
