ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random number within a range and hold it

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
hat-rack
Random number within a range and hold it
on Aug 7, 2007 at 4:32:48 pm

Hi,

I've been able to get a random number from 0-1000 using:

wiggle(0,1000);

This generates the number and it stays the same over the whole time line. Now I need to get a random number from 1000-2000. How can I accomplish this with wiggle or is there a different method? I tried:

random(1000,2000);

but this generates a random number for every frame that plays.

Thanks!




Return to posts index

Dan Ebberts
Re: Random number within a range and hold it
on Aug 7, 2007 at 5:49:34 pm

This should do it:

seedRandom(index,true);
random(1000,2000);



Dan





Return to posts index

Harry Davidson
Re: Random number within a range and hold it
on Feb 26, 2018 at 12:33:32 pm

Thanks Dan!


Return to posts index


Patricio Veloso
Re: Random number within a range and hold it
on Mar 21, 2018 at 12:06:22 pm

Thanks Dan for your invaluable support to the AE community woldwide.
Hugs!


Return to posts index

Victor Pérez
Re: Random number within a range and hold it
on Jan 23, 2020 at 10:59:53 pm

Dear Dan,

I´m using the expression you suggested to get a random number between 1 and 5.
Yet I´d like to have this expression to be re-evaluated so I can end up with a different value the next time I open the after effects project.

Eg. let´s say the 1st time I open the file its value is 3 and if I load the file again the value changes (within the range of course)

seedRandom(index,true);
random(1,5);


Return to posts index

Dan Ebberts
Re: Random number within a range and hold it
on Jan 24, 2020 at 1:22:54 am

I can't think of anything an expression could access that would be unique for each AE launch. You do get that automatically with scripting though, so I guess you could have a simple script populate a slider with a random number and use that as the random seed for your expression, but you'd have to remember to run the script each time you launch AE.

Dan



Return to posts index


Matthias Stoll
Re: Random number within a range and hold it
on Jan 24, 2020 at 8:49:50 am

Talking about randoms, this is only a little bit related... I've been wondering about it quite a while now. In a project I had about 50 dots and I needed to connect with lines them in a "Plexus"-like fashion, but only some dots needed to connect.

I used random expressions to target 2 dot-layers giving the coordinates for start and ending of every line (shape layers). Of course some of the results were equal, and I had to manually eliminate those double lines - because I could not think of another way.

So my question: Can I somehow save results from a random expression and then exclude them from the range of the next one? All random expressions would need to connect to another expression doing this.

This should be possible, any ideas out there?


Return to posts index

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