Mailing List AE-List@media-motion.tv — Message #65601
From: Rick Gerard <AE-List@media-motion.tv>
Sender: Rick Gerard <ae@mstrg.com>
Subject: Re: [AE] long string of random nimbers
Date: Sat, 14 Sep 2019 12:26:45 -0700
To: After Effects Mail List <AE-List@media-motion.tv>
Here are a few basics: 
The randomI() method generates a random number between 0 and 1
The random seed is based on the layer number unless you specify it
If you don’t mind not having a zero appear in the first column a simple linear(t, tMin, tMax, value1, value2) will generate random numbers.
Adding Math.floor, or round to the result of the linear method will eliminate the decimal point.

EZ solution for 7 digets:
t = random();
value = linear(t, .00000001, 1, 1000000, 9999999);
Math.floor(value)

You can make as many digits ad you like. If you want leading zeros the expression gets a lot more complicated:

t = random();
value = linear(t, .00000001, 1, 0, 9999999);
nums = Math.floor(value)
// The new stuff

amtOfZeroes = 7;// match the largest number above

isNeg = false;
if(nums < 0)
{
nums = Math.abs( nums );
isNeg = true;
}
sVal = Math.round( nums ) + "";
while(sVal.length < amtOfZeroes)
{
sVal = "0" + sVal; 
}
if(isNeg)
sVal = "-" + sVal;

sVal




 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster