One easy way to do this is to use an expression to generate a random whole number. Simply add an empty text layer, then spin down layer properties and add this expression to the Source Text property:
pause = .5; // seconds
seed = Math.floor(time/pause);
n = random(0, 9);
- The first line sets a value in seconds for the time between number changes.
- The second line divides comp tie by the pause value to generate a value for the random seed and rounds that number to an integer.
- The third line tells the random number generator to use the seed you've generated.
- The fourth line sets the value to the random number between 0 and 9.
- The last line rounds the random number to an integer
You could also write the expression like this:
But it's much more difficult to tell what's going on when you're just getting started.
Now you've got a number between 0 and 9 that changes every half second that you can incorporate into a design. Each duplicate will be a different random number. You can change the pause value for each duplicate so that the numbers are not all changing at the same time. You can also vary the range so that some numbers are between 1 and 3 for example.
I hope this helps.
If you want your values to be not so random, you can also pull them from arrays:
Furthermore, also consider that you usually want to show a variability on some base value as opposed to jumping all across the board, so use something like this:
sChange=0.5; //change time seedRandom=Math.floor(time/sChange); sVar=50; //variation sBase=300; //base value sOut=sBase+Math.round(random(-sVar,sVar)); [sOut]
I noticed a typo in Mylenium's expression. The random seed line should be:
His expression is also a little more elegant than mine.
*oops* Thanks for the correction, Rick. ;-)