java.lang.Object
org.praxislive.code.CodeDelegate
org.praxislive.code.DefaultCodeDelegate
- All Implemented Interfaces:
DefaultDelegateAPI
- Direct Known Subclasses:
AudioCodeDelegate,CoreCodeDelegate,DataCodeDelegate,P2DCodeDelegate,P3DCodeDelegate,VideoCodeDelegate
Default base for code delegates providing a variety of functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal doublerandom(double max) Return a random number between zero and max (exclusive)final doublerandom(double min, double max) Return a random number between min (inclusive) and max (exclusive)final doublerandomOf(double... values) Return a random element from an array of values.final intrandomOf(int... values) Return a random element from an array of values.final StringReturn a random element from an array of values.Methods inherited from class org.praxislive.code.CodeDelegate
ask, ask, async, find, getLookup, isLoggable, log, log, log, log, millis, self, self, tell, tell, tell, tellIn, tellIn, tellIn, time, transmit, transmit, transmitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.praxislive.code.DefaultDelegateAPI
abs, acos, array, array, array, asin, atan, atan2, B, constrain, constrain, cos, D, D, degrees, dist, dist, exp, I, I, lerp, log, map, max, max, max, max, max, max, min, min, min, min, min, min, norm, pow, radians, round, S, sin, sq, sqrt, tan, V
-
Field Details
-
RND
-
-
Constructor Details
-
DefaultCodeDelegate
public DefaultCodeDelegate()
-
-
Method Details
-
random
public final double random(double max) Return a random number between zero and max (exclusive)- Specified by:
randomin interfaceDefaultDelegateAPI- Parameters:
max- the upper bound of the range- Returns:
-
random
public final double random(double min, double max) Return a random number between min (inclusive) and max (exclusive)- Specified by:
randomin interfaceDefaultDelegateAPI- Parameters:
min- the lower bound of the rangemax- the upper bound of the range- Returns:
-
randomOf
public final double randomOf(double... values) Return a random element from an array of values.- Specified by:
randomOfin interfaceDefaultDelegateAPI- Parameters:
values- list of values, may not be empty- Returns:
- random element
-
randomOf
public final int randomOf(int... values) Return a random element from an array of values.- Specified by:
randomOfin interfaceDefaultDelegateAPI- Parameters:
values- list of values, may not be empty- Returns:
- random element
-
randomOf
Return a random element from an array of values.- Specified by:
randomOfin interfaceDefaultDelegateAPI- Parameters:
values- list of values, may not be empty- Returns:
- random element
-