Random Values

Random numbers often play an important role with natural phenomena: not everything is completely predictable and slight variations care for more realism. For this purpose we can use RealFlow’s built-in random number generator. This tool works exactly as any other of the “Curve Editor’s” functions. You can also create random values from the time variables f and t, e.g.

rnd(f) or rnd(t)

 

 

As you can see from the image the values are getting bigger and bigger. This has something to do with the random function’s mode of operation. In this case – rnd(f) – RealFlow expressions create random values between 0 and f, so with growing f, the resulting values become larger and larger. If you enter a simple number n then the range will be between 0 and n, as shown here:

 


The expression used for the previous example is just

rnd(3.0)

The values will be between 0 and 3.0. By adding a random value to a given number you can create jitter or oscillations effects, for example for wind or an emitter’s speed value. Here the y axis of a "Wind" daemon carries an expression. The "Wind" daemon would randomly oscillate between 42.5 and 47.5 degrees. That is an average of 45 degrees. So we can easily define a main wind direction including slight variations:

Wind01.position_Y = 42.5 + rnd(5)

A very interesting field of application is the addition of standard functions and random values. Then we can define a kind of base movement with an overlying noise frequency:

sin(f*5) + rnd(0.5)

To restate: with the “+” button left of the expression input field it is also possible to add any random function to an existing animation curve with keys.

Random numbers are an extremely versatile method to create more realistic and not absolutely perfect motions. Randomness is a principle that can be used for many things and with slight variations simulations often look better. A really helpful method is to combine random functions with keyed animations, using the “+” button again.