Genuine randomness solves a specific creative problem that manual keyframing struggles with, producing motion or values that feel organic and unpredictable rather than obviously patterned. The random expression in After Effects gives editors direct access to this kind of controlled unpredictability, and understanding its various forms opens up applications well beyond simple random number generation.
The random expression in After Effects generates unpredictable numeric values within a specified range, and can be applied to nearly any property to introduce natural feeling variation without manual keyframing. This post covers the basic random expression syntax, how to constrain its output to a useful range, how seedRandom provides repeatable randomness when needed, and several practical applications including randomized timing, scattered positioning, and flickering effects. It also includes a genuine video walkthrough, frequently asked questions, and guidance on combining random with other expression techniques.
By Jack Wright, Founder, Freevisuals. Updated 2026.
At its simplest, the random expression generates a new random value every single frame, applied directly to any property that accepts a numeric input. Written without any arguments, it returns a value between zero and one, which is rarely useful on its own for most animation purposes since most properties need a considerably wider or differently scaled range of values than this default zero to one span provides.
Providing a single numeric argument changes the output range to fall between zero and that specified number instead, while providing two arguments defines both a minimum and maximum value explicitly, giving you precise control over exactly what range of random values a given property should receive. This two argument form is what most practical applications actually rely on, since it lets you constrain randomness to a range that makes genuine sense for the specific property being affected.
Applying random directly to a property like rotation without constraining its range appropriately can produce wildly excessive, unusable spinning rather than the subtle variation typically intended. Thinking carefully about what range of values genuinely makes sense for your specific creative intent, a small rotation wobble might only need a range of a few degrees in either direction, while a scattered positioning effect might reasonably need a considerably wider range spanning a significant portion of your composition's dimensions.
Testing your chosen range against real footage or graphics, rather than assuming a specific numeric range will automatically look correct, helps calibrate genuinely appropriate values for your specific project rather than working from a generic assumption that may not translate well to your particular composition's actual scale and context.
For a broader look at how expressions are written and tested within a real After Effects project, watch Learn After Effects Expressions For Beginners, which covers foundational syntax directly relevant to understanding how random and other expression functions are structured and applied. This is worth watching because seeing the expression editor used live, including how quickly you can test different numeric ranges and observe the resulting change, helps build the habit of iterative testing that genuinely effective expression work depends on.
Since a plain random expression generates a genuinely new value on every single frame by default, this can be a problem for situations where you want randomness that stays consistent across multiple views or renders of the same project, rather than producing different results every single time your composition is played back or rendered. The seedRandom function addresses this specifically, letting you specify a fixed seed value that produces the exact same sequence of pseudo random numbers every time, ensuring consistent, repeatable results across multiple sessions working with the same project.
This matters considerably for client facing work specifically, where a client reviewing a project across multiple separate sessions should see the exact same randomized result each time rather than a different random pattern on every single playback, which could otherwise create confusion about whether something in the project has actually changed between review sessions.
A genuinely useful application involves using random to generate a randomized start time offset for an animation applied across multiple similar layers, avoiding the mechanical, obviously synchronized look that occurs when several identical elements animate in perfect unison. Applying a small random time offset to each individual layer's animation start point creates a more organic, naturally varied group animation, useful for particle style effects, multiple text elements entering a scene, or any situation involving several similar layers that should feel independently, naturally timed rather than robotically synchronized.
Applying random independently to a layer's horizontal and vertical position values, each with its own appropriately scaled range, creates naturally scattered positioning across multiple duplicated layers, useful for particle effects, scattered debris, or randomly distributed graphic elements across a composition. Using seedRandom with a different specific seed value for each individual layer, rather than the same seed across all of them, ensures each layer receives a genuinely different scattered position rather than all layers coincidentally landing on the same random value due to sharing an identical seed.
Applying random to an opacity or brightness property, constrained to a range that produces subtle rather than extreme variation, creates a naturally flickering effect useful for simulating unstable lighting, old film degradation, or electrical malfunction style visual effects. Combining this with a wiggle expression for simultaneous subtle position jitter can further enhance the sense of unstable, degraded footage for stylized vintage or horror themed content specifically wanting this kind of unsettling, unstable visual quality.
A frequent mistake involves applying random without appropriately constraining its range, producing wildly excessive results far beyond what the creative intent actually called for. Another common issue involves expecting consistent, repeatable randomness without using seedRandom, then being confused when a project's random elements appear different across separate playback sessions, when in fact plain random expressions are specifically designed to generate new values continuously rather than staying fixed by default.
A related mistake involves using an identical seed value across multiple layers that are each meant to display independently varied randomness, inadvertently causing them all to share the exact same random pattern rather than genuinely independent variation, since identical seed values with identical underlying expressions will always produce identical results.
Rather than allowing random to regenerate a completely new value every single frame, which produces genuinely chaotic, rapidly flickering results unsuitable for most applications beyond deliberate strobe effects, combining random with a time based check lets you control specifically how often a new random value gets generated. Using the built in time variable divided by a chosen interval, then rounding that result down to a whole number before feeding it into a seed value, produces a random value that changes only at your specified interval, once per second, for instance, rather than on every single individual frame.
This technique genuinely expands what random can practically achieve, since many creative applications benefit from randomness that changes at a deliberate, controlled pace rather than the default frame by frame chaos a plain random expression produces on its own. A randomly shifting color accent that changes every few seconds, or a randomly selected animation variant that switches periodically throughout a longer piece of content, both rely on this kind of controlled, interval based random generation rather than the raw, unconstrained default behavior.
Many properties in After Effects, position most notably, are represented as multi dimensional arrays rather than single numeric values, and applying random correctly to these properties requires understanding this underlying structure. Rather than a single random call, generating independent random values for each individual dimension, horizontal and vertical position separately, for instance, and combining them into a properly formatted array gives you genuinely independent control over randomization along each separate axis, rather than accidentally applying the exact same random value uniformly across dimensions that should actually vary independently of one another.
This distinction matters considerably for scattered positioning effects specifically, where horizontal and vertical scatter often need meaningfully different ranges depending on your composition's specific aspect ratio and the visual effect you are actually trying to achieve, rather than both dimensions sharing an identical, undifferentiated random range that may not suit your composition's actual proportions.
When random does not produce the expected result, working through a systematic checklist resolves most issues efficiently. Confirming your minimum and maximum arguments are actually in the correct order, minimum first and maximum second, catches a surprisingly common simple error that produces confusing results otherwise. Checking whether you intended to use seedRandom for consistency but forgot to include it, or conversely included it when you actually wanted fresh randomness on every frame, resolves another frequent source of unexpected behavior.
For array based properties specifically, confirming your expression returns a properly formatted array matching the property's expected dimensional structure, rather than a single flat numeric value, resolves errors that specifically arise from applying random incorrectly to inherently multi dimensional properties like position.
Naturally varied, organic feeling animation pairs well with the kind of considered motion graphics work our own After Effects templates library is built around. Our free LUT library is also worth pairing with any project needing a consistent color treatment. For premium templates and additional creative assets, Motion Array and Envato are both worth browsing, and for music to pair with a finished project, Artlist and Epidemic Sound are both genuinely strong options.
This is the default, intended behavior of a plain random expression, generating a fresh value on every single frame. For consistent, repeatable results across multiple sessions, use seedRandom with a fixed seed value instead.
Provide two numeric arguments to the expression, defining an explicit minimum and maximum value, rather than relying on the default zero to one range which is rarely wide or appropriately scaled enough for most practical animation purposes.
This typically happens when identical seed values are used across multiple layers with otherwise identical expressions. Using a different specific seed value for each individual layer ensures genuinely independent, varied random results across your duplicated layers.
Yes, though color properties in After Effects are typically represented as multiple separate numeric channel values, so random needs to be applied individually to each relevant channel, or combined into an array format matching the specific property's expected structure.
No, though both introduce unpredictability. Random generates a discrete value within a specified range, while wiggle produces continuous, smoothly varying motion over time. The two are often used together for combined effects but serve genuinely different underlying purposes.
The random expression gives editors direct, flexible control over introducing genuine unpredictability into an animation, from subtle timing variation through to fully scattered positioning and flickering effects. Understanding how to appropriately constrain its range, when to use seedRandom for repeatable results, and how to vary seed values across multiple layers for genuinely independent randomness rounds out a foundational expression skill with applications across a remarkably wide range of creative and practical motion graphics needs.
Combined with the interval based control and array formatting techniques covered above, random moves well beyond a simple novelty function into a genuinely versatile tool worth understanding thoroughly for any editor regularly working with expression driven animation across varied project types.