| **Universal Random Expression**
on May 26, 2018 at 7:31:09 pm |

Is there an expression that meets the following requirements?:

- Doesn't require existing keyframes (automatic).
- Allows me to adjust how many times per second it spits out a new random value (like the first number in the wiggle expression).
- Allows me to specify the smallest and largest value allowed (for example, a lowest value of -80 and a largest value of 30).

At first, I thought I would be able to achieve this with a simple wiggle expression, however, it doesn't allow me to specify the smallest and largest value.

| **Re: Universal Random Expression** on May 26, 2018 at 8:33:43 pm |

Something like this maybe:

f = 3; // 3 random values per second

minVal = -80;

maxVal = 30;

seed = Math.floor(time*f);

seedRandom(seed,true);

random(minVal,maxVal)

Dan

| **Re: Universal Random Expression** on May 27, 2018 at 10:28:36 am |

Thank you, Dan, however, I need an expression that generates "smooth transitions" between the values, just like the wiggle expression. In other words, I need an expression that works just like the wiggle expression except I need to be able to specify the largest and smallest value allowed AND how many times per second a new value will be generated.

Is this possible?

| **Re: Universal Random Expression** on May 27, 2018 at 1:40:02 pm |

The same with an eased transition, for one-dimensional properties:

`frequency = 1;`

min= 500;

max = 250;

time1 = Math.floor((time-inPoint)*frequency);

seedRandom(time1, true);

val1 = random(min, max);

time2 = Math.floor((time-inPoint)*frequency+1);

seedRandom(time2, true);

val2 = random(min, max);

ease(time, time1, time2, [val1],[val2])

Kalleheikki Kannisto

Senior Graphic Designer

| **Re: Universal Random Expression** on May 27, 2018 at 4:44:24 pm |

Kalleheikki, your expression works great UNTIL I change the frequency because when I do, the smooth transitions no longer works:

| **Re: Universal Random Expression** on May 27, 2018 at 5:12:40 pm |

I finally found a working expression written by Dan Ebberts in this thread:

https://forums.creativecow.net/thread/227/20157
The expression:

`minVal = -80;`

maxVal = 30;

w = wiggle(5,1)-value;

value + linear(w,-1,1,minVal,maxVal)