public static final class Random.CompositeEngine extends java.lang.Object implements Random.Engine
Random.CompositeEngine
class is a reusable implementation of the Engine interface.
It uses a set of objects that provide facilities to set up the randomizer and to generate data
of specific types.Constructor and Description |
---|
CompositeEngine(Random.Initializer initializer)
Constructs a CompositeEngine object that uses the specified initializer.
|
Modifier and Type | Method and Description |
---|---|
Data |
random(DataTypeId typeId,
int size)
Generated random data of the specified type and size.
|
void |
setGenerator(DataTypeId typeId,
Random.TypedGenerator generator)
Sets a generator responsible for generating data of the specified type.
|
void |
setSeed(int seed)
Sets a new seed of the random data generation engine.
|
void |
setUp()
Sets up the generation engine (if it requires some setup before being used).
|
public CompositeEngine(Random.Initializer initializer)
initializer
- Initializer to be used to set up the randomizer.public void setGenerator(DataTypeId typeId, Random.TypedGenerator generator)
typeId
- Type identifier.generator
- Generator to the specified type.java.lang.IllegalArgumentException
- if any of the parameters equals null
.public void setUp()
Random.Engine
setUp
in interface Random.Engine
public void setSeed(int seed)
Random.Engine
setSeed
in interface Random.Engine
seed
- The seed to be set.public Data random(DataTypeId typeId, int size)
random
in interface Random.Engine
typeId
- Data type identifier.size
- Data type size (in bits).java.lang.IllegalArgumentException
- if the typeId parameter equals null
.java.lang.UnsupportedOperationException
- if random data generation is not supported by the given
data type.