| java.lang.Object | |
| ↳ | java.util.Random |
Known Direct Subclasses
|
This class provides methods that generates pseudo-random numbers of different types, such as int, long, double and float using either
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Construct a random generator with the current time of day in milliseconds
as the initial state.
| |||||||||||
Construct a random generator with the given
seed as the
initial state. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the next pseudo-random, uniformly distributed boolean value
generated by this generator.
| |||||||||||
Modifies the byte array by a random sequence of bytes generated by this
random number generator.
| |||||||||||
Generates a normally distributed random double number between 0.0
inclusively and 1.0 exclusively.
| |||||||||||
Generates a normally distributed random float number between 0.0
inclusively and 1.0 exclusively.
| |||||||||||
pseudo-randomly generates (approximately) a normally distributed
double value with mean 0.0 and a standard deviation value
of 1.0 using the polar method of G. | |||||||||||
Returns to the caller a new pseudo-random integer value which is uniformly
distributed between 0 (inclusively) and the value of
n
(exclusively). | |||||||||||
Generates a uniformly distributed 32-bit
int value from
the this random number sequence. | |||||||||||
Generates a uniformly distributed 64-bit
int value from
the this random number sequence. | |||||||||||
Modifies the seed using linear congruential formula presented in The
Art of Computer Programming, Volume 2, Section 3.2.1.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a pseudo-random uniformly distributed
int value of
the number of bits specified by the argument bits as
described by Donald E. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Construct a random generator with the current time of day in milliseconds as the initial state.
Construct a random generator with the given seed as the
initial state.
| seed | the seed that will determine the initial state of this random number generator |
|---|
Returns the next pseudo-random, uniformly distributed boolean value generated by this generator.
Modifies the byte array by a random sequence of bytes generated by this random number generator.
| buf | non-null array to contain the new random bytes |
|---|
Generates a normally distributed random double number between 0.0 inclusively and 1.0 exclusively.
Generates a normally distributed random float number between 0.0 inclusively and 1.0 exclusively.
pseudo-randomly generates (approximately) a normally distributed
double value with mean 0.0 and a standard deviation value
of 1.0 using the polar method of G. E. P. Box, M.
E. Muller, and G. Marsaglia, as described by Donald E. Knuth in The
Art of Computer Programming, Volume 2: Seminumerical Algorithms,
section 3.4.1, subsection C, algorithm P
Returns to the caller a new pseudo-random integer value which is uniformly
distributed between 0 (inclusively) and the value of n
(exclusively).
| n | int |
|---|
Generates a uniformly distributed 32-bit int value from
the this random number sequence.
int valueGenerates a uniformly distributed 64-bit int value from
the this random number sequence.
int random numberModifies the seed using linear congruential formula presented in The Art of Computer Programming, Volume 2, Section 3.2.1.
| seed | the seed that alters the state of the random number generator |
|---|
Returns a pseudo-random uniformly distributed int value of
the number of bits specified by the argument bits as
described by Donald E. Knuth in The Art of Computer Programming,
Volume 2: Seminumerical Algorithms, section 3.2.1.
| bits | number of bits of the returned value |
|---|