# Help - Random position expression

Hope someone can give me a tip…

I’ve got this simple expression which does the trick except I need to be able to control the speed, for example, rather than every frame, perhaps every second, fourth, fifth frame…

Or even better, something like ‘change layer position between these X and Y ranges every random number of frames between n1 and n2.’

``` X=position[0]+random(900,-300); Y=position[1]+random(-100,500); [X,Y] ```

It’s not really practical in this case to pre-compose the layer and use, say, Posterize Time.

TIA

hi,

Generator said

Hope someone can give me a tip…

I’ve got this simple expression which does the trick except I need to be able to control the speed, for example, rather than every frame, perhaps every second, fourth, fifth frame…

Or even better, something like ‘change layer position between these X and Y ranges every random number of frames between n1 and n2.’

``` X=position[0]+random(900,-300); Y=position[1]+random(-100,500); [X,Y] ```

It’s not really practical in this case to pre-compose the layer and use, say, Posterize Time.

TIA

use a seedRandom and then for the seed a function based on the time.

tFrame = timeToFrames(time);

tSeed = Math.floor(tFrame/3);

seedRandom(tSeed,true);

position + [random(-300,900), random(-100, 500)];

//gives a random position every third frame

Brilliant! Thank you felt.