public class random extends DefaultInternalAction
Internal action: .random(N)
.
Description: unifies N with a random number between 0 and 1.
Parameter:
Example:
.random(X)
: unifies X with one random number between 0 and 1..random(X, 5)
: unifies X with a random number between 0 and 1, and backtracks 5 times. For example: .findall(X, .random(X,5), L) will produce a list of 5 random numbers..random(X, 0)
: unifies X with a random number between 0 and 1, and but backtracks infinitely.function version
,
Serialized FormConstructor and Description |
---|
random() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkArguments(Term[] args) |
static InternalAction |
create() |
java.lang.Object |
execute(TransitionSystem ts,
Unifier un,
Term[] args)
Executes the internal action.
|
int |
getMaxArgs() |
int |
getMinArgs() |
canBeUsedInContext, destroy, prepareArguments, suspendIntention
public static InternalAction create()
public int getMinArgs()
getMinArgs
in class DefaultInternalAction
public int getMaxArgs()
getMaxArgs
in class DefaultInternalAction
protected void checkArguments(Term[] args) throws JasonException
checkArguments
in class DefaultInternalAction
JasonException
public java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.Exception
InternalAction
execute
in interface InternalAction
execute
in class DefaultInternalAction
java.lang.Exception