Package com.jelurida.ardor.contracts
Class DistributedRandomNumberGenerator
java.lang.Object
nxt.addons.AbstractContract<Map<String,Long>,String>
com.jelurida.ardor.contracts.DistributedRandomNumberGenerator
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 -
Method Summary
Modifier and TypeMethodDescriptionprocessInvocation(DelegatedContext context, Map<String, Long> data) Process internal invocation by another contractMethods inherited from class nxt.addons.AbstractContract
isDuplicate, processBlock, processRequest, processTransaction, processVoucherMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nxt.addons.Contract
init, minProductVersion, shutdown
-
Constructor Details
-
DistributedRandomNumberGenerator
public DistributedRandomNumberGenerator()
-
-
Method Details
-
processInvocation
Process internal invocation by another contract- Specified by:
processInvocationin interfaceContract<Map<String,Long>, String> - Overrides:
processInvocationin classAbstractContract<Map<String,Long>, String> - Parameters:
context- the context of the invoking contractdata- a map of accounts and their weight- Returns:
- the selected account id
-