com.jelurida.ardor.contracts

## Class DistributedRandomNumberGenerator

- java.lang.Object
- - nxt.addons.AbstractContract<java.util.Map<java.lang.String,java.lang.Long>,java.lang.String>
  - - com.jelurida.ardor.contracts.DistributedRandomNumberGenerator

- All Implemented Interfaces:
    Contract<java.util.Map<java.lang.String,java.lang.Long>,java.lang.String>

      public class DistributedRandomNumberGenerator
      extends AbstractContract<java.util.Map<java.lang.String,java.lang.Long>,java.lang.String>

  The DistributedRandomNumberGenerator is a utility contract which given a list of accounts and their weight, selects randomly one the accounts. For example, if there are 3 account with weights 5,3,2 the chance of the first account being selected is 50% the 2nd 30% and the 3rd 20%.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DistributedRandomNumberGenerator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `processInvocation(DelegatedContext context, java.util.Map<java.lang.String,java.lang.Long> data)` Process internal invocation by another contract

    - ### Methods inherited from class nxt.addons.AbstractContract

      `isDuplicate, processBlock, processRequest, processTransaction, processVoucher`

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

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

    - ### Methods inherited from interface nxt.addons.Contract

      `minProductVersion`

- - ### Constructor Detail

    - #### DistributedRandomNumberGenerator

          public DistributedRandomNumberGenerator()

  - ### Method Detail

    - #### processInvocation

          public java.lang.String processInvocation(DelegatedContext context,
                                                    java.util.Map<java.lang.String,java.lang.Long> data)

      Process internal invocation by another contract
      Specified by:
        `processInvocation` in interface `Contract<java.util.Map<java.lang.String,java.lang.Long>,java.lang.String>`
      Overrides:
        `processInvocation` in class `AbstractContract<java.util.Map<java.lang.String,java.lang.Long>,java.lang.String>`
      Parameters:
        `context` - the context of the invoking contract
        `data` - a map of accounts and their weight
      Returns:
        the selected account id