ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Wiggle range whole numbers

FAQ   •   VIEW ALL Wiggle range whole numbers on Dec 1, 2016 at 12:08:15 am

I edited this expression from Dan Ebbert's random motion post, but can't figure out how to get whole number values.

```segMin = .1; //minimum segment duration segMax = .3; //maximum segment duration minVal = 1; maxVal = 5; end = 0; j = 0; while ( time >= end){ j += 1; seedRandom(j,true); start = end; end += random(segMin,segMax); } endVal = random(minVal,maxVal); seedRandom(j-1,true); dummy=random(); //this is a throw-away value startVal = random(minVal,maxVal); ```

Jason Jantzen
vimeo.com/jasonj Re: Wiggle range whole numberson Dec 1, 2016 at 12:28:16 am

Try this:

``` segMin = .1; //minimum segment duration segMax = .3; //maximum segment duration minVal = 1; maxVal = 5; end = 0; j = 0; while ( time >= end){ j += 1; seedRandom(j,true); start = end; end += random(segMin,segMax); } endVal = Math.floor(random(minVal,maxVal+1)); seedRandom(j-1,true); dummy=random(); //this is a throw-away value startVal = Math.floor(random(minVal,maxVal+1)); ```

Dan Re: Wiggle range whole numberson Dec 1, 2016 at 12:32:46 am