# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Changing random time

• # Changing random time

2 Members · 3 Posts
• ### Scott McGee

January 13, 2023 at 11:34 am

Possibly no solution, but i’m going to chuck it out there.

I want to randomly scale my text, but I don’t want it to just be every 1 second, 2 seconds etc. The below works fine if I want it to change every second.

seed = Math.floor(time/1);

seedRandom(seed,true);

s = random(100,150);
[s,s]

Is there a way to randomly change this bit?

seed = Math.floor(time/random).

So that when it’s reach 1 lets say, it changes to 0.5, then when it reaches 0.5 it changes to 0.75 (these numbers would be random between set integers obviously)

• ### Scott McGee

January 13, 2023 at 11:43 am

Unless there’s a tidier way, I think I found something that I’ve altered that appears to work.

minDur = .5;

maxDur = 1;

t = tPrev = inPoint;

seedRandom(index,true);

while (t <= time){

tPrev = t;

t += random(minDur,maxDur);

}

s = random(100,300);

[s,s]

• ### Dan Ebberts

January 13, 2023 at 3:04 pm

That’s pretty much how I’d do it unless you want to ramp from one value to the next, in which case I’d do something like this:

`minVal = 100;maxVal = 300;minDur = .5;maxDur = 1;tEase = .1;t = tPrev = inPoint;seedRandom(index,true);while (t <= time){tPrev = t;  t += random(minDur,maxDur);}seedRandom(tPrev,true);s1 = random(minVal,maxVal);seedRandom(t,true);s2 = random(minVal,maxVal);s = ease(time,tPrev,tPrev+tEase,s1,s2);[s,s]`
Viewing 1 - 3 of 3 posts

Log in to reply.

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