@FunctionalInterface public interface Generator
enum types, String and BigInteger.
Most methods provide a default implementation that (directly or indirectly) uses anyBits(int).
The latter is the only method without a default implementation.
package| Modifier and Type | Method and Description |
|---|---|
default BigInteger |
anyBigInteger()
|
default BigInteger |
anyBigInteger(BigInteger bound)
|
default BigInteger |
anyBigInteger(BigInteger min,
BigInteger bound)
|
BigInteger |
anyBits(int numBits)
Returns any non-negative
BigInteger representing a sequence of significant bits of a given length. |
static BigInteger |
anyBits(int numBits,
Random random)
Utility method:
Returns a randomly generated non-negative
BigInteger representing a sequence of
significant bits of a given length, intended as a result of anyBits(int). |
default boolean |
anyBoolean()
Returns any
boolean value. |
default byte |
anyByte()
Returns any
byte value. |
default char |
anyChar()
Returns any
char value of a predefined character set. |
default char |
anyChar(String characters)
Returns any
char value of the given characters. |
default double |
anyDouble()
Returns a
double value between zero (incl.) and one (excl.). |
default float |
anyFloat()
Returns a
float value between zero (incl.) and one (excl.). |
default int |
anyInt()
Returns any
int value. |
default int |
anyInt(int bound)
Returns an
int value between zero (incl.) and bound (excl.). |
default int |
anyInt(int min,
int bound)
Returns an
int value between min (incl.) and bound (excl.). |
default long |
anyLong()
Returns any
long value. |
default long |
anyLong(long bound)
Returns any
long value between zero (incl.) and bound (excl.). |
default long |
anyLong(long min,
long bound)
Returns any
long value between min (incl.) and bound (excl.). |
default <T extends Enum<T>> |
anyOf(Class<T> enumClass)
Returns one of the given
enum values. |
default <T> T |
anyOf(T... values)
Returns one of the given
values. |
default short |
anyShort()
Returns any
short value. |
default BigInteger |
anySmallBigInteger()
Returns a
BigInteger value between zero (incl.) and 216 (excl.). |
default BigInteger |
anySmallBigInteger(BigInteger bound)
|
default int |
anySmallInt(int bound)
Returns an
int value between zero (incl.) and bound (excl.). |
default String |
anyString() |
default String |
anyString(int length,
String characters)
|
static Generator |
of(Random random)
|
static BigInteger anyBits(int numBits, Random random)
BigInteger representing a sequence of
significant bits of a given length, intended as a result of anyBits(int).default boolean anyBoolean()
boolean value.
A typical implementation will return one of {true, false}, with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default byte anyByte()
byte value.
A typical implementation will return an arbitrary byte value,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default short anyShort()
short value.
A typical implementation will return an arbitrary short value,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default int anyInt()
int value.
A typical implementation will return an arbitrary int value,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default int anyInt(int bound)
int value between zero (incl.) and bound (excl.).
A typical implementation will return an arbitrary int value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default int anyInt(int min,
int bound)
int value between min (incl.) and bound (excl.).
A typical implementation will return an arbitrary int value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default int anySmallInt(int bound)
int value between zero (incl.) and bound (excl.).
A typical implementation will return an arbitrary int value within the defined bounds,
with smaller values being more probable than bigger values.
The default implementation depends on the implementation of anyBits(int).
default long anyLong()
long value.
A typical implementation will return an arbitrary long value,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default long anyLong(long bound)
long value between zero (incl.) and bound (excl.).
A typical implementation will return an arbitrary long value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default long anyLong(long min,
long bound)
long value between min (incl.) and bound (excl.).
A typical implementation will return an arbitrary long value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default float anyFloat()
float value between zero (incl.) and one (excl.).
A typical implementation will return an arbitrary long value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default double anyDouble()
double value between zero (incl.) and one (excl.).
A typical implementation will return an arbitrary long value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default BigInteger anyBigInteger()
BigInteger value between Long.MIN_VALUE and Long.MAX_VALUE (both incl.).
A typical implementation will return an arbitrary BigInteger value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default BigInteger anyBigInteger(BigInteger bound)
BigInteger value between BigInteger.ZERO (incl.) and bound (excl.).
A typical implementation will return an arbitrary BigInteger value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default BigInteger anyBigInteger(BigInteger min, BigInteger bound)
BigInteger value between min (incl.) and bound (excl.).
A typical implementation will return an arbitrary BigInteger value within the defined bounds,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default BigInteger anySmallBigInteger()
BigInteger value between zero (incl.) and 216 (excl.).
A typical implementation will return an arbitrary BigInteger value within the defined bounds,
with smaller values being more probable than bigger values.
The default implementation depends on the implementation of anyBits(int).
default BigInteger anySmallBigInteger(BigInteger bound)
BigInteger value between BigInteger.ZERO (incl.) and bound (excl.).
A typical implementation will return an arbitrary value within the defined bounds, with smaller values being more probable than bigger values.
The default implementation depends on the implementation of anyBits(int).
default char anyChar()
char value of a predefined character set.
A typical implementation will return an arbitrary char value within the predefined character set,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int) and returns
one of "0123456789_abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ !#$§%&*+,.?@äöüÄÖÜß".
default char anyChar(String characters)
char value of the given characters.
A typical implementation will return an arbitrary char value within the given characters,
with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
characters - A String made up of the characters that are a possible result.default String anyString(int length, String characters)
String with the given length consisting of the given characters.
The default implementation depends on the implementation of anyBits(int).
length - The length of the resulting string.characters - A string made up of the characters that make up a possible result.default String anyString()
default <T> T anyOf(T... values)
values.
A typical implementation will return an arbitrary value within the defined bounds, with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
default <T extends Enum<T>> T anyOf(Class<T> enumClass)
enum values.
A typical implementation will return an arbitrary value within the defined bounds, with each possible value being equally probable.
The default implementation depends on the implementation of anyBits(int).
BigInteger anyBits(int numBits)
BigInteger representing a sequence of significant bits of a given length.
In other words, the result is any value between zero (inclusive) and 2length (exclusive).
A typical implementation will return an arbitrary value within the defined bounds, with each possible value being equally probable.
Copyright © 2024 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.