Animating with the Channel Editor > Expressions > Function Reference >

# Random Number Functions

Use the following functions to create curves based on random values.

rand

Returns a random value between -1 and 1, based on the value used as an argument, called the seed. Using the same seed in the rand function for multiple channels produces the exact same results. To create completely random results, use the true rand function.

Syntax: | rand(Seed)
Arguments: | Seed is the value used to generate the random return value. This is usually set to a changing value such as the current frame number.
Examples: | rand(frame % 10) * 50 + 50 returns a set of random values between0 and 100 that repeats every 10 frames. rand(frame) * 100 returns a random value between -100 and 100for every frame in the animation. The following curve shows the result of this function:

truerand

Returns a truly random value between two given numbers. The sequence of returned values will constantly change, never reproducing past results.

Syntax: | truerand(Low, High)
Arguments: | Low and High are the upper and lower bounds, respectively, of the random number to generate.
Example: | truerand(-5.5,10.8) returns a truly random value between -5.5and 10.8.

noise

Returns a random value between -1 and 1, based on a given vector. If the parameter varies smoothly, this function will return a continuously changing value that also varies smoothly.

Syntax: | noise(Position)
Arguments: | Position is a vector used as a seed for the returned random value.
Examples: | noise(frame) * 5 returns a continuous random value between-5 and 5. (noise(axis1.position) + 1) / 2 * 100 returns a continuous random value between 0 and 100. noise(axis1.position) * 100 yields the following curve:

noise3

Returns a random vector for all elements in a vector between -1 and 1. If the parameter varies smoothly, this function will return a vector of continuously changing values that also vary smoothly.

Syntax: | noise3(Position)
Arguments: | Position is a vector used as a seed for the returned random vector.
Examples: | noise3(frame) * 5 returns a vector of continuous random values between -5 and 5. (noise3(axis1.position) + 1) / 2 * 100 returns a vector of continuous random values between 0 and 100. noise3(axis1.position) * 100 returns the following three curves:

fnoise

Returns a random value between -1 and 1, based on a given vector. If the parameter varies smoothly, this function will return a continuously changing value that also varies smoothly to a fractal pattern. This function is similar to the noise function, but it applies a fractal pattern to the result.

Syntax: | fnoise(Position)
Arguments: | Position is a vector used as a seed for the returned random value.
Examples: | fnoise(frame) * 5 returns a continuous random value between-5 and 5. (fnoise(axis1.position) + 1) / 2 * 100 returns a continuous random value between 0 and 100. fnoise(axis1.position) * 100 yields the following curve:

turbulence

Returns a random value between -1 and 1, based on a given vector and with the ability to control the level of smoothness for the resulting curve.

Syntax: | turbulence(Position, Level)
Arguments: | Position is a vector used as a seed for the returned random value. Level is a positive integer where the greater the value, the greater the jitter applied to the resulting curve. If this argument is set to a value less than 1, the level will be treated as if 1 were used. If it is set to a number with a fractional component, the number will be rounded down to the nearest integer.
Examples: | turbulence(axis1.position, 1) * 100 yields the following curve: turbulence(axis1.position, 8) * 100 yields the following curve:

turbulence3

Returns a random vector for all elements in a vector between -1 and 1, along with the ability to control the smoothness of the resulting curve. If the position parameter varies smoothly, this function will return a vector of continuously changing values that also vary smoothly.

Syntax: | turbulence3(Position, Level)
Arguments: | Position is a vector used as a seed for the returned random vector. Level is a positive integer used to control the level of jitter of the resulting curve. If this argument is set to a value less than 1, the level will be treated as if 1 were used. If it is set to a number with a fractional component, the number will be rounded down to the nearest integer.
Examples: | turbulence3(axis1.position, 1) * 100 returns the following three curves: turbulence3(axis1.position, 8) * 100 returns the following three curves: