Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random Number Expressions

  • Random Number Expressions

    Posted by Cameron Crook on September 24, 2010 at 5:18 am

    Hi, I am trying to create a matrix rain type effect. I am using a custom particle i am creating driven by the random() expression function to generate random integers between 0 and 9 and it also has the posterized function to keep it from changing every frame. Is there an expression i can use to ensure that each time the integer changes it doesn’t end up being the same integer as the previous. These are the expressions i have in my source text as of now:

    Thanks for any help

    posterizeTime(10);
    s=random(9);
    Math.round(s)

    Cameron Crook replied 15 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 25, 2010 at 12:28 am

    This expression should give you a different digit every three frames:

    holdFrames = 3;
    seedRandom(index,true);
    f = timeToFrames();
    seg = Math.floor(f/holdFrames);
    r = Math.floor(random(10));
    for (i = 0; i < seg; i++) r = (r + Math.floor(random(1,10)))%10;
    r

    Dan

  • Cameron Crook

    September 25, 2010 at 2:54 am

    Thanks that is exactly what i needed.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy