|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pholser.junit.quickcheck.random.SourceOfRandomness
public class SourceOfRandomness
A source of randomness, fed to Generators so they can produce
random values for theory parameters.
| Constructor Summary | |
|---|---|
SourceOfRandomness(Random delegate)
Makes a new source of randomness. |
|
| Method Summary | |
|---|---|
BigInteger |
nextBigInteger(int numberOfBits)
Gives a random BigInteger representable by the given number of bits. |
boolean |
nextBoolean()
|
byte |
nextByte(byte min,
byte max)
Gives a random byte value v such that min <= v <= max, uniformly distributed across
the interval [min, max]. |
void |
nextBytes(byte[] bytes)
|
byte[] |
nextBytes(int count)
Gives an array of a given length containing random bytes. |
char |
nextChar(char min,
char max)
Gives a random char value v such that min <= v <= max, uniformly distributed across
the interval [min, max]. |
double |
nextDouble()
|
double |
nextDouble(double min,
double max)
Gives a random double value v such that min <= v < max. |
float |
nextFloat()
|
float |
nextFloat(float min,
float max)
Gives a random float value v such that min <= v < max. |
double |
nextGaussian()
|
int |
nextInt()
|
int |
nextInt(int n)
|
int |
nextInt(int min,
int max)
Gives a random int value v such that min <= v <= max, uniformly distributed across
the interval [min, max]. |
long |
nextLong()
|
long |
nextLong(long min,
long max)
Gives a random long value v such that min <= v <= max, uniformly distributed across
the interval [min, max]. |
short |
nextShort(short min,
short max)
Gives a random short value v such that min <= v <= max, uniformly distributed across
the interval [min, max]. |
void |
setSeed(long seed)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SourceOfRandomness(Random delegate)
delegate - a JDK source of randomness, to which the new instance will delegate| Method Detail |
|---|
public boolean nextBoolean()
Random.nextBoolean()public void nextBytes(byte[] bytes)
Random.nextBytes(byte[])public double nextDouble()
Random.nextDouble()public float nextFloat()
Random.nextFloat()public double nextGaussian()
Random.nextGaussian()public int nextInt()
Random.nextInt()public int nextInt(int n)
Random.nextInt(int)public long nextLong()
Random.nextLong()public void setSeed(long seed)
Random.setSeed(long)
public byte nextByte(byte min,
byte max)
byte value v such that min <= v <= max, uniformly distributed across
the interval [min, max].
min - lower bound of the desired rangemax - upper bound of the desired range
public short nextShort(short min,
short max)
short value v such that min <= v <= max, uniformly distributed across
the interval [min, max].
min - lower bound of the desired rangemax - upper bound of the desired range
public char nextChar(char min,
char max)
char value v such that min <= v <= max, uniformly distributed across
the interval [min, max].
min - lower bound of the desired rangemax - upper bound of the desired range
public int nextInt(int min,
int max)
int value v such that min <= v <= max, uniformly distributed across
the interval [min, max].
min - lower bound of the desired rangemax - upper bound of the desired range
public long nextLong(long min,
long max)
long value v such that min <= v <= max, uniformly distributed across
the interval [min, max].
min - lower bound of the desired rangemax - upper bound of the desired range
public float nextFloat(float min,
float max)
Gives a random float value v such that min <= v < max.
This naive implementation takes a random float value from Random.nextFloat() and
scales/shifts the value into the desired range. This may give surprising results for large ranges.
min - lower bound of the desired rangemax - upper bound of the desired range
public double nextDouble(double min,
double max)
Gives a random double value v such that min <= v < max.
This naive implementation takes a random double value from Random.nextDouble() and
scales/shifts the value into the desired range. This may give surprising results for large ranges.
min - lower bound of the desired rangemax - upper bound of the desired range
public byte[] nextBytes(int count)
count - the desired length of the random byte array
Random.nextBytes(byte[])public BigInteger nextBigInteger(int numberOfBits)
BigInteger representable by the given number of bits.
numberOfBits - the desired number of bits
BigIntegerBigInteger.BigInteger(int, java.util.Random)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||