public class JinahyaRandom extends Object implements Serializable
| Constructor and Description |
|---|
JinahyaRandom(Random random)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
nextBytes(int minimumLength,
int maximumLength)
Generates a random byte array.
|
static byte[] |
nextBytes(Random random,
int minimumLength,
int maximumLength)
Generates a random byte array.
|
protected int |
nextInt(int minimum,
int maximum)
Returns a pseudorandom, uniformly distributed
int value between
minimum (inclusive) and maximum (exclusive), drawn from
the wrapped random number generator's sequence. |
static int |
nextInt(Random random,
int minimum,
int maximum)
Returns a pseudorandom, uniformly distributed
int value between
minimum (inclusive) and maximum (exclusive), drawn from
the given random number generator's sequence. |
int |
nextSignedInt(int minimumBitLength,
int maximumBitLength)
Generates a signed integer in arbitrary bit length.
|
long |
nextSignedLong(int minimumBitLength,
int maximumBitLength)
Generates a signed long in arbitrary bit length.
|
int |
nextUnsignedInt(int minimumBitLength,
int maximumBitLength)
Generates an unsigned integer in arbitrary bit length.
|
long |
nextUnsignedLong(int minimumBitLength,
int maximumBitLength)
Generates an unsigned long in arbitrary bits.
|
public JinahyaRandom(Random random)
random - the random to be wrapped.public static int nextInt(Random random, int minimum, int maximum)
int value between
minimum (inclusive) and maximum (exclusive), drawn from
the given random number generator's sequence. An instance of
IllegalArgumentException will thrown if the range is greater than
.random - randomminimum - the lower bound on the random number to returnedmaximum - the upper bound on the random number to returned; must be
greater than or equal to minimum.int value
between minimum (inclusive) and maximum (exclusive) from
the wrapped random number generator's sequence.public static byte[] nextBytes(Random random, int minimumLength, int maximumLength)
minimumLength (inclusive) and maximumLength (exclusive).random - randomminimumLength - minimum array length; must be greater than or equal
to 0.maximumLength - maximum array length; must be greater than or equal
to minimumLength.protected int nextInt(int minimum,
int maximum)
int value between
minimum (inclusive) and maximum (exclusive), drawn from
the wrapped random number generator's sequence. An instance of
IllegalArgumentException will thrown if the range is greater than
.minimum - the lower bound on the random number to returnedmaximum - the upper bound on the random number to returned; must be
greater than or equal to minimum.int value
between minimum (inclusive) and maximum (exclusive) from
the wrapped random number generator's sequence.public byte[] nextBytes(int minimumLength,
int maximumLength)
minimumLength (inclusive) and maximumLength (exclusive).minimumLength - minimum array length; must be greater than or equal
to 0.maximumLength - maximum array length; must be greater than or equal
to minimumLength.public int nextUnsignedInt(int minimumBitLength,
int maximumBitLength)
1 <= minimumBitLength <= maximumBitLength <= 32.minimumBitLength - the minimum number of bits; must be greater than
or equal to 1.maximumBitLength - the maximum number of bits; must be between
minimumBitLength (inclusive) and 32
(exclusive).public int nextSignedInt(int minimumBitLength,
int maximumBitLength)
1 <= minimumBitLength <= maximumBitLength < 32.minimumBitLength - the minimum number of bits; must be greater than
1.maximumBitLength - the maximum number of bits; must be between
minimumBitLength (inclusive) and 32
(inclusive).public long nextUnsignedLong(int minimumBitLength,
int maximumBitLength)
1 <= minimumBitLength <= maximumBitLength < 64.minimumBitLength - the minimum number of bits; must be greater than
or equal to 1.maximumBitLength - the maximum number of bits; must be between
minimumBitLength (inclusive) and 64
(exclusive).public long nextSignedLong(int minimumBitLength,
int maximumBitLength)
1 < minimumBitLength <= maximumBitLength <= 64.minimumBitLength - the minimum number of bits; must be greater than
1.maximumBitLength - the maximum number of bits; must be between
minimumBitLength (inclusive) and 64
(inclusive).Copyright © 2011-2013. All Rights Reserved.