Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression: Random letter generator and number generator

  • Expression: Random letter generator and number generator

    Posted by Ryan Wetherall on March 4, 2012 at 9:20 pm

    Hello,

    I am creating a motion graphic that calls for a script that needs generate a single random letter a certain amount of times per second, I have not tried something like this with expressions so I’m not sure how to go about making it. Im guessing I will probably need a frequency of 5 letters generated a second or something close.

    Similarly, I need an expression that can generate a random single digit number a certain amount of times per second as well. I have tried using the number plugin that comes with the software, but there is no way to restrict the random value generator to a single digit. I have also tried using the wiggler, setting the value to 5 and having it randomly generate numbers within 4 digits, but that causes me to get duplicate numbers next to each other sometimes which is not what I am looking for.

    Can anyone help me out? Thanks!
    -Ryan

    Richard Arreguin replied 9 years, 9 months ago 4 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 4, 2012 at 10:37 pm

    You might be able to do it with a character Value or Character Offset animator with a Wiggly selector, or these source text expression should help.

    This one generates a random digit 5 times a second:

    rate = 5;
    seed = Math.floor(time*rate);
    seedRandom(seed,true);
    “” + Math.floor(random(10));

    This one generates a random letter:

    rate = 5;
    seed = Math.floor(time*rate);
    seedRandom(seed,true);
    String.fromCharCode(65 + Math.floor(random(26)));

    Dan

  • Navarro Parker

    July 31, 2012 at 6:22 pm

    Hey Dan,

    How would you combine these into one expression to get a two character alpha/numeric output? Would changing the last line this be correct?

    String.fromCharCode(65 + Math.floor(random(26))) + Math.floor(random(10));

  • Dan Ebberts

    July 31, 2012 at 7:01 pm

    That should work–try it.

    Dan

  • Richard Arreguin

    July 21, 2016 at 3:33 pm

    Please reactivate my account.

    240230u18602926540188491

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