FORUMS: list search recent posts

Expression: Random letter generator and number generator

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Wetherall
Expression: Random letter generator and number generator
on Mar 4, 2012 at 9:20:12 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


Return to posts index

Dan Ebberts
Re: Expression: Random letter generator and number generator
on Mar 4, 2012 at 10:37:09 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



Return to posts index

Navarro Parker
Re: Expression: Random letter generator and number generator
on Jul 31, 2012 at 6:22:06 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));


Return to posts index


Dan Ebberts
Re: Expression: Random letter generator and number generator
on Jul 31, 2012 at 7:01:28 pm

That should work--try it.

Dan



Return to posts index

Richard Arreguin
Re: Expression: Random letter generator and number generator
on Jul 21, 2016 at 3:33:38 pm

Please reactivate my account.

240230u18602926540188491


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]