Package de.gebit.integrity.runner.operations

## 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
    --- | --- | ---
    `BigDecimal` | `execute​(Object aPrefixParameter, Integer aPostfixParameter)` | Executes the operation logic.
    `static long` | `getSeed()` |
    `static void` | `seed​(Long aSeed)` | Sets a new seed and reseeds the RNG.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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