Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random Incremental Numbers

  • Random Incremental Numbers

    Posted by Rafael Cruz on May 2, 2009 at 3:50 am

    I have an expression in place which generates random numbers between a set of values, but I would like to make a subtle adjustment. I would like to increase the number sequentially, by random increments.

    Dan Ebberts replied 17 years ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 4, 2009 at 2:42 pm

    Something like this maybe?

    max = 10;
    min = 1;

    seedRandom(index,true);
    f = timeToFrames();

    accum = 0;
    for (i = 0; i <= f; i++) accum += random(min,max); accum Dan

  • Rafael Cruz

    May 6, 2009 at 3:01 pm

    Thanks Dan.
    Seems like just what I needed, with one exception.

    The number accumulates with every frame. I’ve tried to make the adjustment and haven’t succeeded. How can I control the variable for the timing (whether by frames of secs) of the random number accumulation?

  • Dan Ebberts

    May 6, 2009 at 5:15 pm

    Try this one:

    max = 10;
    min = 1;
    holdFrames = 10;

    seedRandom(index,true);
    f = timeToFrames();
    seg = Math.floor(f/holdFrames);

    accum = 0;
    for (i = 0; i <= seg; i++) accum += random(min,max); accum Dan

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