jason.stdlib
Class random
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.random
- All Implemented Interfaces:
- InternalAction, java.io.Serializable
public class random
- extends DefaultInternalAction
Internal action: .random(N)
.
Description: unifies N with a random number between 0 and 1.
Parameter:
- - value (number): the variable to receive the random value
- + quantify of random numbers (number, optional): default value is 1, value = 0 means that an infinify number of random numbers will be produced (this is useful for some backtrack circumstances).
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.
- See Also:
function version
,
Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
random
public random()
create
public static InternalAction create()
getMinArgs
public int getMinArgs()
- Overrides:
getMinArgs
in class DefaultInternalAction
getMaxArgs
public int getMaxArgs()
- Overrides:
getMaxArgs
in class DefaultInternalAction
checkArguments
protected void checkArguments(Term[] args)
throws JasonException
- Overrides:
checkArguments
in class DefaultInternalAction
- Throws:
JasonException
execute
public java.lang.Object execute(TransitionSystem ts,
Unifier un,
Term[] args)
throws java.lang.Exception
- Description copied from interface:
InternalAction
- Executes the internal action. It should return a Boolean or
an Iterator. A true boolean return means that the IA was
successfully executed. An Iterator result means that there is
more than one answer for this IA (e.g. see member internal action).
- Specified by:
execute
in interface InternalAction
- Overrides:
execute
in class DefaultInternalAction
- Throws:
java.lang.Exception