| java.lang.Object java.util.Random
All known Subclasses: java.security.SecureRandom,
Constructor Summary | |
public | Random() Construct a random generator with the current time of day in milliseconds
as the initial state. | public | Random(long seed) Construct a random generator with the given seed as the
initial state. |
Method Summary | |
protected synchronized int | next(int bits) Returns a pseudo-random uniformly distributed int value of
the number of bits specified by the argument bits .
Implements D. | public boolean | nextBoolean() Answers the next pseudo-random, uniformly distributed boolean value
generated by this generator. | public void | nextBytes(byte[] buf) Modifies the byte array by a random sequence of bytes generated by this
random number generator. | public double | nextDouble() Generates a normally distributed random double number between 0.0
inclusively and 1.0 exclusively. | public float | nextFloat() Generates a normally distributed random float number between 0.0
inclusively and 1.0 exclusively. | public synchronized double | nextGaussian() Returns a pseudo-randomly generated, normally distributed
double value with mean 0.0 and a standard deviation value
of 1.0 .
Implements G. | public int | nextInt() Generates a uniformly distributed 32-bit int value from
the this random number sequence. | public int | nextInt(int n) Returns a new pseudo-random integer value which is uniformly distributed
between 0 (inclusively) and n (exclusively). | public long | nextLong() Generates a uniformly distributed 64-bit int value from
the this random number sequence. | public synchronized void | setSeed(long seed) Modifies the seed using a linear congruential formula, as found in The
Art of Computer Programming, Volume 2, by Donald E. |
Random | public Random()(Code) | | Construct a random generator with the current time of day in milliseconds
as the initial state.
See Also: Random.setSeed |
Random | public Random(long seed)(Code) | | Construct a random generator with the given seed as the
initial state.
Parameters: seed - the seed that will determine the initial state of this randomnumber generator See Also: Random.setSeed |
nextBoolean | public boolean nextBoolean()(Code) | | Answers the next pseudo-random, uniformly distributed boolean value
generated by this generator.
boolean a pseudo-random, uniformly distributed boolean value |
nextBytes | public void nextBytes(byte[] buf)(Code) | | Modifies the byte array by a random sequence of bytes generated by this
random number generator.
Parameters: buf - non-null array to contain the new random bytes See Also: Random.next |
nextDouble | public double nextDouble()(Code) | | Generates a normally distributed random double number between 0.0
inclusively and 1.0 exclusively.
a random double between 0.0 and 1.0 See Also: Random.nextFloat |
nextFloat | public float nextFloat()(Code) | | Generates a normally distributed random float number between 0.0
inclusively and 1.0 exclusively.
a random float between 0.0 and 1.0 See Also: Random.nextDouble |
nextGaussian | public synchronized double nextGaussian()(Code) | | Returns a pseudo-randomly generated, normally distributed
double value with mean 0.0 and a standard deviation value
of 1.0 .
Implements G. E. P. Box, M. E. Muller, and G. Marsaglia's polar method
found in The Art of Computer Programming, Volume 2: Seminumerical
Algorithms, by Donald E. Knuth (section 3.4.1).
a pseudo-randomly generated double See Also: Random.nextDouble |
nextInt | public int nextInt(int n)(Code) | | Returns a new pseudo-random integer value which is uniformly distributed
between 0 (inclusively) and n (exclusively).
a randomly generated int between 0 and n Parameters: n - the upper limit of the values that can be returned |
setSeed | public synchronized void setSeed(long seed)(Code) | | Modifies the seed using a linear congruential formula, as found in The
Art of Computer Programming, Volume 2, by Donald E. Knuth (section
3.2.1).
Parameters: seed - the seed that alters the state of the random number generator See Also: Random.next See Also: Random.Random() See Also: Random.Random(long) |
|
|