public final class JVMRandom extends Random
JVMRandom is a wrapper that supports all possible
Random methods via the Math.random() method
and its system-wide Random object.
| 构造器和说明 |
|---|
JVMRandom()
Constructs a new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value
from the Math.random() sequence.
|
void |
nextBytes(byte[] byteArray)
Unsupported in 2.0.
|
double |
nextDouble()
Synonymous to the Math.random() call.
|
float |
nextFloat()
Returns the next pseudorandom, uniformly distributed float value
between
0.0 and 1.0 from the Math.random()
sequence. |
double |
nextGaussian()
Unsupported in 2.0.
|
int |
nextInt()
Returns the next pseudorandom, uniformly distributed int value
from the Math.random() sequence.
|
int |
nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between
0 (inclusive) and the specified value (exclusive), from
the Math.random() sequence. |
long |
nextLong()
Returns the next pseudorandom, uniformly distributed long value
from the Math.random() sequence.
|
static long |
nextLong(long n)
Returns a pseudorandom, uniformly distributed long value between
0 (inclusive) and the specified value (exclusive), from
the Math.random() sequence. |
void |
setSeed(long seed)
Unsupported in 2.0.
|
public void setSeed(long seed)
setSeed 在类中 Randomseed - ignoredUnsupportedOperationException - unsupportedOperationExceptionpublic double nextGaussian()
nextGaussian 在类中 RandomUnsupportedOperationException - unsupportedOperationExceptionpublic void nextBytes(byte[] byteArray)
nextBytes 在类中 RandombyteArray - ignoredUnsupportedOperationException - unsupportedOperationExceptionpublic int nextInt()
Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.
public int nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between
0 (inclusive) and the specified value (exclusive), from
the Math.random() sequence.
nextInt 在类中 Randomn - the specified exclusive max-valueIllegalArgumentException - when n <= 0public long nextLong()
Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.
public static long nextLong(long n)
Returns a pseudorandom, uniformly distributed long value between
0 (inclusive) and the specified value (exclusive), from
the Math.random() sequence.
n - the specified exclusive max-valueIllegalArgumentException - when n <= 0public boolean nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
nextBoolean 在类中 Randompublic float nextFloat()
Returns the next pseudorandom, uniformly distributed float value
between 0.0 and 1.0 from the Math.random()
sequence.
public double nextDouble()
Synonymous to the Math.random() call.
nextDouble 在类中 RandomCopyright © 2023 AnswerAIL. All rights reserved.