Class RandomNumberOperation
- java.lang.Object
-
- de.gebit.integrity.runner.operations.RandomNumberOperation
-
- All Implemented Interfaces:
Operation<Object,Integer,BigDecimal>
public class RandomNumberOperation extends Object implements Operation<Object,Integer,BigDecimal>
A random number generator. This one is special in several respects: it is automatically seeded on execution start, it caches randoms determined for every custom operation instance, and its seed is forwarded to forks to ensure their randomness is in sync with that of the master. All of this is required to safely work with random elements in Integrity tests. This operation doesn't have any input parameters, it just returns a random decimal number between 0 and 1.- Author:
- Rene Schneider - initial API and implementation
-
-
Constructor Summary
Constructors Constructor Description RandomNumberOperation()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimalexecute(Object aPrefixParameter, Integer aPostfixParameter)Executes the operation logic.static longgetSeed()static voidseed(Long aSeed)Sets a new seed and reseeds the RNG.
-
-
-
Method Detail
-
seed
public static void seed(Long aSeed)
Sets a new seed and reseeds the RNG.- Parameters:
aSeed-
-
getSeed
public static long getSeed()
-
execute
public BigDecimal execute(Object aPrefixParameter, Integer aPostfixParameter)
Description copied from interface:OperationExecutes the operation logic.- Specified by:
executein interfaceOperation<Object,Integer,BigDecimal>- Parameters:
aPrefixParameter- the prefix parameter, or null if none was given or the value is not available at the time of the callaPostfixParameter- the postfix parameter, or null if none was given or the value is not available at the time of the call- Returns:
- the result value
-
-