Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Create new random number each time it plays?

  • Dan Ebberts

    May 23, 2013 at 7:56 pm

    I’m not aware of a reliable way to do it. You can use something like this to get the current milliseconds since 1970:

    d = new Date(Date(0));
    d.getTime()

    So in theory, you could use that as a random seed like this:

    d = new Date(Date(0));
    seedRandom(d.getTime(),true);

    The problem is that the cache doesn’t get invalidated by this so to get it to actually change you have to purge the cache. On top of that, there’s no way to restrict it to happening only at the first frame, so your random numbers won’t be consistent througout the preview.

    Dan

  • Greg Neumayer

    May 23, 2013 at 10:35 pm

    Hmmm. Bummer. Yeah, I can’t get it to do anything refreshable. I’ve got a series of Particular emitters flying in unison, so as a stop-gap, I’ve linked all their Random Seed values to an external RefreshCache slider. Now I just change that slider value to refresh Particular. Not elegant, but it works.

    Thanks for checking.

    Antifreeze Design
    https://www.antifreezedesign.com

  • Greg Neumayer

    May 23, 2013 at 10:45 pm

    Oh, just to be clear, they all link to the slider multiplied by their index to keep their numbers unique.

    i.e: thisComp.layer(“control”).effect(“RefreshCache”)(“Slider”)*index;

    Antifreeze Design
    https://www.antifreezedesign.com

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