ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

seedrandom vs random

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nitai Lev-Oren
seedrandom vs random
on Jan 16, 2019 at 5:41:31 pm

what is the difference between seedrandom vs random expression?


Return to posts index

Dan Ebberts
Re: seedrandom vs random
on Jan 16, 2019 at 6:13:32 pm

seedRandom() doesn't produce a random number, it just seeds the random number generator, which will cause subsequent calls to random() to generate a different sequence of random numbers.

It's like there's a big book of random numbers, and each call to random() retrieves the next number from the book. seedRandom() lets you change to a different page in the book.


Dan



Return to posts index

Jeff Kay
Re: seedrandom vs random
on Jan 16, 2019 at 6:49:25 pm

An effect of this is that with a set seedRandom, random() will always generate the same [randomly generated] results, while random() absent of a seedRandom being set will generate different results every time you preview, render, or move your playhead.

This means that any previewing you do will necessarily be different than your export unless a seedRandom value is set. I might not always use the offset or timeless modifiers for seedRandom, but I honestly don't know of a situation that I wouldn't set seedRandom if I'm using random().


Return to posts index


Nitai Lev-Oren
Re: seedrandom vs random
on Jan 16, 2019 at 7:33:00 pm

I don't get it...

do you have examples of seedrandom?


Return to posts index

Dan Ebberts
Re: seedrandom vs random
on Jan 16, 2019 at 7:46:07 pm

This will generate a different random number between 0 and 100 every frame, and the numbers will be different, depending on where the layer is in the layer stack of the timeline:

random(100);

This will generate a different random number every frame, but the numbers won't change if you move the layer around in the layer stack:

seedRandom(index);
random(100)

This will generate the same random number on every frame:

seedRandom(index,true);
random(100);


Dan



Return to posts index

Nitai Lev-Oren
Re: seedrandom vs random
on Jan 17, 2019 at 7:42:08 am

so seedRandom refers to the number of the layer in the layer stack?

and what is the parameter "timeless" means.

if it is true it will not randomize the numbers and if it is false it will randomize the numbers?


Return to posts index


Dan Ebberts
Re: seedrandom vs random
on Jan 17, 2019 at 9:35:18 am

>so seedRandom refers to the number of the layer in the layer stack?

No, you can use any number as the seed. Each unique seed will give you a different sequence of random numbers when you call random().

>and what is the parameter "timeless" means. if it is true it will not randomize the numbers and if it is false it will randomize the numbers?

No, true means you get the same random numbers at each frame, false means you get different random numbers at each frame.


Dan



Return to posts index

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