<p>To do this on one text layer you could use this expression in the sourceText:</p>

<pre><code>Math.round(random(36));
</code></pre>

<p>If you'd like to keep the two layers then on the first layer use:</p>

<pre><code>Math.round(random(3));
</code></pre>

<p>and on the second layer use:</p>

<pre><code>Math.round(random(9));
</code></pre>

<p>The number in the brackets of the random expression is the limit, so if it's set to 100, the random expression will return a value between 0 and 100.</p>

CC BY-SA 4.0
2020-04-28T08:39:23.707Z
Thanks ! But; i'm probably doing something wrong because i'm still saying higher numbers in my random count. 
https://ibb.co/y6s8vyv
Randy V
CC BY-SA 4.0
2020-04-28T08:59:11.513Z
Is it the text animator? If it's changing the character value then this may be the cause - try removing the text animator and see if it limits the randomness.
Made by Loop
CC BY-SA 4.0
2023-01-13T10:44:47.707Z
If you make an expression like this:

Math.round(random(36));

You will get random numbers between 0 and 35, as the expression counts from zero.

A roulette table has numbers from 0-36, so you probably want

Math.round(random(37));
tomh
CC BY-SA 4.0
2020-04-27T11:12:16.077Z
2020-04-27T11:12:16.077Z
Made by Loop
<p>I'm animating a roulette table; above the roulette is an animated text with random numbers untill the winning numbers apears on the roulette table; but the random numbers are from 0-99; i've made it so that the 2 numbers are each on a layer; so that limits it to 0-9; but i would like the animation of the first layer to 0,1,2 or 3. I was searching for a regex but i have no clue what i'm doing...</p>

<p>In any way; i would love it when the random numnbers would be between 00 and 36 as that are the only numbers on a roulette table. </p>

<p>Thanks guys !</p>

<after-effects><animation><after-effects-expressions>
AE: Limit Characters in random range selector animation
Randy V
# AE: Limit Characters in random range selector animation

(Asked by: username_0 on 2020-04-27)

I'm animating a roulette table; above the roulette is an animated text with random numbers untill the winning numbers apears on the roulette table; but the random numbers are from 0-99; i've made it so that the 2 numbers are each on a layer; so that limits it to 0-9; but i would like the animation of the first layer to 0,1,2 or 3. I was searching for a regex but i have no clue what i'm doing...

In any way; i would love it when the random numnbers would be between 00 and 36 as that are the only numbers on a roulette table.

Thanks guys !

**Tags:** after-effects, animation, after-effects-expressions


---

## 1 answers

### Answer by username_1 on 2020-04-27. Score: 0

To do this on one text layer you could use this expression in the sourceText:
Math.round(random(36));

If you'd like to keep the two layers then on the first layer use:
Math.round(random(3));

and on the second layer use:
Math.round(random(9));

The number in the brackets of the random expression is the limit, so if it's set to 100, the random expression will return a value between 0 and 100.

> **Comments:**
> **username_0**: Thanks ! But; i'm probably doing something wrong because i'm still saying higher numbers in my random count.  https://ibb.co/y6s8vyv  
> **username_1**: Is it the text animator? If it's changing the character value then this may be the cause - try removing the text animator and see if it limits the randomness.  
> **username_2**: If you make an expression like this:  Math.round(random(36));  You will get random numbers between 0 and 35, as the expression counts from zero.  A roulette table has numbers from 0-36, so you probably want  Math.round(random(37));  

---

