THE PACKAGE JAVA.UTIL
java.util.Random
21.9
21.9.2
protected double nextNextGaussian;
A variable used by method
nextGaussian
( 21.9.12) to hold a precomputed
value to be delivered by that method the next time it is called.
21.9.3
protected boolean haveNextNextGaussian = false;
A variable used by method
nextGaussian
( 21.9.12) to keep track of whether it
has precomputed and stashed away the next value to be delivered by that method.
21.9.4
public Random()
This constructor initializes a newly created
Random
number generator by using the
current time of day ( 20.18.6) as a seed.
public Random() { this(System.currentTimeMillis()); }
21.9.5
public Random(long seed)
This constructor initializes a newly created
Random
number generator by using the
argument
seed
as a seed.
public Random(long seed) { setSeed(seed); }
21.9.6
public void setSeed(long seed)
The general contract of
setSeed
is that it alters the state of this random number
generator object so as to be in exactly the same state as if it had just been created
with the argument
seed
as a seed.
The method
setSeed
is implemented by class
Random
as follows:
synchronized public void setSeed(long seed) {
this.seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) 1);
haveNextNextGaussian = false;
}
The implementation of
setSeed
by class
Random
happens to use only 48 bits of
the given seed. In general, however, an overriding method may use all 64 bits of
the long argument as a seed value.
[In certain early versions of Java, the
setSeed
method failed to reset the value
of
haveNextNextGaussian
to
false
; this flaw could lead to failure to produce
repeatable behavior.]
647
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved