public final class Random
extends java.lang.Object
Data
and Variable
objects). The current implementation uses the Randomizer
class to generate random values.
It is possible to customize the behavior by providing a custom generation engine (a custom
implementation of the Random.Engine
interface).Modifier and Type | Class and Description |
---|---|
static class |
Random.CompositeEngine
The CompositeEngine class is a reusable implementation of the Engine interface.
|
static interface |
Random.Engine
The Engine interface is a common interface to be implemented by all generation engines.
|
static interface |
Random.Initializer
The Initializer interface is to be implemented by objects that are responsible for initializing
some specific generation engine.
|
static interface |
Random.TypedGenerator
The TypedGenerator interface is a common interface for objects that are responsible for
generating data of some specific type.
|
Modifier and Type | Method and Description |
---|---|
static Variable |
assignValue(Variable variable)
Assigns a random value to the specified variable.
|
static Random.Engine |
getEngine()
Returns an instance of the random data generation engine.
|
static Data |
newValue(DataType type)
Creates a data object of the specified type initialized with a random value.
|
static Variable |
newVariable(java.lang.String name,
DataType type)
Creates a variable of the specified type initialized with a random value.
|
static void |
setEngine(Random.Engine value)
Sets the random data generation engine to be used to generate data.
|
static void |
setSeed(int seed)
Sets a new seed of the random data generation engine.
|
public static Random.Engine getEngine()
public static void setEngine(Random.Engine value)
value
- Random data generation engine.java.lang.NullPointerException
- if the parameter equals null.public static void setSeed(int seed)
seed
- The seed to be set.public static Data newValue(DataType type)
type
- Data type.java.lang.NullPointerException
- if the parameter equals null.java.lang.UnsupportedOperationException
- if random data generation is not supported by the given
data type.public static Variable newVariable(java.lang.String name, DataType type)
name
- Variable name.type
- Variable data type.java.lang.NullPointerException
- if any of the parameters equals null.java.lang.UnsupportedOperationException
- if random data generation is not supported by the given
data type.public static Variable assignValue(Variable variable)
variable
- Variable to be assigned.java.lang.NullPointerException
- if the parameter equals null.java.lang.UnsupportedOperationException
- if random data generation is not supported by the given
data type.