Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions generate varying lengths of random numbers

  • generate varying lengths of random numbers

    Posted by Shaun Young on April 18, 2009 at 8:02 pm

    I want to create an effect using expressions that will randomly generate numbers on one line with length between say 3 and 15 digits, then move that line down 1 and generate a new line at the top, repeating, so it looks like a stream of ‘data’ is being received, logged, and scrolled down the comp.

    i’m very new to expressions and was hoping someone could help.

    Shaun Young replied 17 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 18, 2009 at 8:30 pm

    The are a lot of possibilities. Try plugging this into the source text property of a text layer:

    frames = 4; // generate new number every 4 frames
    minDigits = 3;
    maxDigits = 15;

    f = timeToFrames();
    n = Math.floor(f/frames);

    s = “”;
    seedRandom(index,true)

    while (n >= 0){
    num = “” + Math.floor(random(100000000000000,999999999999999));
    numDigits = Math.floor(random(minDigits,maxDigits));
    s = num.substr(0,numDigits) + “r” + s;
    n–;
    }
    s

    Dan

  • Shaun Young

    April 18, 2009 at 8:58 pm

    This is perfect! Thank you so much!

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