Math Functions
random(float) or randon(float, float)
With one parameter, random() will return a random number (float) between 0 and the number given. The parameter is the high value in the range, while the low value will be zero
With two parameters, random() with return a random number between the first parameter and the second parameter. The first parameter will be the low value in the range while the second parameter will be the high value in the range.
Example:
// This code will return a value between 1 and 10
float randNum = random(1,10);
Using random() in Processing - Bing video
With one parameter, random() will return a random number (float) between 0 and the number given. The parameter is the high value in the range, while the low value will be zero
With two parameters, random() with return a random number between the first parameter and the second parameter. The first parameter will be the low value in the range while the second parameter will be the high value in the range.
Example:
// This code will return a value between 1 and 10
float randNum = random(1,10);
Using random() in Processing - Bing video
pow(float, float);
Calculates the power or exponent. Parameter 1 is the base, parameter 2 is the exponent.
Example:
// the following code calculates 2 to the power 3
float power = pow(2,3);
Calculates the power or exponent. Parameter 1 is the base, parameter 2 is the exponent.
Example:
// the following code calculates 2 to the power 3
float power = pow(2,3);