Class RandomChoice
java.lang.Object
nz.org.riskscape.engine.function.BaseRealizableFunction
nz.org.riskscape.engine.function.maths.RandomChoice
- All Implemented Interfaces:
nz.org.riskscape.engine.rl.RealizableFunction
Used to randomly choose an item from a list. Helpful in models where you have a set of known values, but you also want some randomness in which value gets used.
-
Nested Class Summary
Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.RealizableFunction
nz.org.riskscape.engine.rl.RealizableFunction.MetadataIdentifiedRealizableFunction
-
Field Summary
Fields inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction
arguments, returnType
-
Constructor Summary
-
Method Summary
Methods inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction
asFunction, builtin, getArguments, getReturnType, identified, realize
-
Constructor Details
-
RandomChoice
public RandomChoice()
-
-
Method Details
-
build
public nz.org.riskscape.engine.function.RiskscapeFunction build(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> givenTypes) throws nz.org.riskscape.problem.ProblemException Description copied from class:BaseRealizableFunction
This method is internal to the sub-class. Simple realizable functions can just implement this, to jump straight to the meat of building the realized function. You should throw a ProblemException for any errors encountered.
- Overrides:
build
in classBaseRealizableFunction
- Throws:
nz.org.riskscape.problem.ProblemException
-