Java Reference
In-Depth Information
Random
Package:
java.util
Ancestor classes:
Object
|
+--Random
public
Random()
Creates a new random number generator.
public
Random(
long
seed)
Creates a new random number generator with the specifi ed seed value.
public int
nextInt(
int
n)
Returns a pseudo-random, uniformly distributed
int
value between 0 (inclusive) and the
value
n
(exclusive).
public double
nextDouble(
double
n)
Returns a pseudo-random, uniformly distributed
double
value between 0 (inclusive) and
1 (exclusive).
RandomAccessFile
Package:
java.io
Object
|
+--RandomAccessFile
public
RandomAccessFile(String fileName, String mode)
public
RandomAccessFile(File fileObject, String mode)
Opens the fi le, does not delete data already in the fi le, but does position the fi le pointer at the
fi rst (zeroth) location.
The
mode
must be one of the following:
"r"
Open for reading only.
"rw"
Open for reading and writing.
"rws"
Same as
"rw"
, and also requires that every update to the fi le's content or metadata be
written synchronously to the underlying storage device.
"rwd"
Same as
"rw"
, and also requires that every update to the fi le's content be written
synchronously to the underlying storage device.
"rws"
and
"rwd"
are not covered in this topic text.
public void
close()
throws
IOException
Closes the stream's connection to a fi le.