Class 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 Detail

      • RandomNumberOperation

        public RandomNumberOperation()
    • 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: Operation
        Executes the operation logic.
        Specified by:
        execute in interface Operation<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 call
        aPostfixParameter - 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