|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PRNG
Pseudorandom number generator interface.
| Method Summary | |
|---|---|
PRNG |
clone()
Returns a new instance of this PRNG with the same state, meaning that each instance will independently generate the same sequence. |
PRNGProvider |
getPRNGProvider()
|
int |
nextBits(int bits)
Returns an int containing the given number of random bits. |
BitVector |
nextBitVector(int numBits)
Returns the next pseudorandom, uniformly distributed BitVector value between 0 and
2numBits. |
boolean |
nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean
value from the generator's sequence. |
boolean |
nextBoolean(double probability)
Returns a pseudorandom boolean value from the generator's
sequence with the given probability that it will be true. |
boolean |
nextBoolean(float probability)
Returns a pseudorandom boolean value from the generator's
sequence with the given probability that it will be true. |
double |
nextDouble()
Returns the next pseudorandom, uniformly distributed double
value between 0.0 and 1.0 from the
generator's sequence. |
float |
nextFloat()
Returns the next pseudorandom, uniformly distributed float
value between 0.0 and 1.0 from the
generator's sequence. |
int |
nextInt()
Returns the next pseudorandom, uniformly distributed int
value from the generator's sequence. |
int |
nextInt(int limit)
Returns the next pseudorandom, uniformly distributed, positive int value between 0 (inclusive) and
limit (exclusive) from the generator's sequence. |
int |
nextInt(int min,
int max)
Returns the next pseudorandom, uniformly distributed int
value between min and max (inclusive) from
the generator's sequence. |
void |
nextInts(int[] array,
int start,
int count)
Fills the given array with random ints, as if nextBits(32) were called for each element. |
long |
nextLong()
Returns the next pseudorandom, uniformly distributed long
value from the generator's sequence. |
| Method Detail |
|---|
PRNGProvider getPRNGProvider()
int nextBits(int bits)
PRNGProvider
nextBits in interface PRNGProviderbits - the number of random bits requested, which must be greater
than or equal to zero
void nextInts(int[] array,
int start,
int count)
PRNGProvider
nextInts in interface PRNGProviderarray - the array to fillstart - the starting index to fillcount - the number of elements to fill, which must be greater than
or equal to zeroboolean nextBoolean()
boolean
value from the generator's sequence.
boolean nextBoolean(float probability)
boolean value from the generator's
sequence with the given probability that it will be true.
probability - a float between 0 and 1 (inclusive)
boolean nextBoolean(double probability)
boolean value from the generator's
sequence with the given probability that it will be true.
probability - a double between 0 and 1 (inclusive)
int nextInt()
int
value from the generator's sequence.
int nextInt(int limit)
int value between 0 (inclusive) and
limit (exclusive) from the generator's sequence.
limit - an int greater than 0 that the generated
int must be less than
0 (inclusive) and
limit (exclusive)
int nextInt(int min,
int max)
int
value between min and max (inclusive) from
the generator's sequence.
min - the minimum value to returnmax - the maximum value to return
min and max
(inclusive)long nextLong()
long
value from the generator's sequence.
float nextFloat()
float
value between 0.0 and 1.0 from the
generator's sequence.
double nextDouble()
double
value between 0.0 and 1.0 from the
generator's sequence.
BitVector nextBitVector(int numBits)
BitVector value between 0 and
2numBits.
numBits - the length of the BitVector to be returned, which must be
greater than 0
IllegalArgumentException - if numBits <= 0.PRNG clone()
clone in interface PRNGProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||