In this quick guide, I’ll share several methods for generating random numbers tailored to your needs.
Whether you’re looking for a random number between 1 and 10 or a 10-digit random number, in a bit you know how.
Table of Contents
Let’s dive in! 🙌
Random number between 0 and 1
Don’t have any requirement to the number? The easiest is to use the random variable:
As you can see, this will generate a random number between 0 and 1 (but not including 1) with 16 decimal places:
random
= 0.5297136290576396
So if that’s all you need, great!
If you need a whole number, or a random number between certain values, keep reading 🤓
Pssst. Want my best tips for Make.com? Get the cheat sheet 😄📩
Psst. Want to get the most out of Make.com? Consider my in-depth course 😄
Psst. Want some 1:1 help with your project? Book a coaching call with me 😄
Random number between 1 and 10
To get a whole number between 1 and 10, we can use the random
variable with some math functions.
First, we multiply the variable by 10 so we get a number between 1 and 10 with decimals:
random*10
= 8.364132191975076
Then, we use the floor()
function to round it down to the nearest whole number.
floor(random*10)
= 8
This will now give us a number from 0 to 9, so simply add 1 to the formula to get a number from 1 to 10.
floor(random*10)+1
= 6
Easy, right?
Random number between 1 and 6
Want to create a fun dice game? 🎲
You can use the same method as above, but then multiply the random
variable by 6.
floor(random*6)+1
= 4
Random percentage
Useful for probability-based automation where you need a percentage value.
This formula essentially gives you a random number between 1 and 100.
floor(random*100)+1
= 48
Or if you need the percentage with it, surround the formula in brackets and add the percentage symbol.
(floor(random*100)+1)%
= 62%
Random number with 10 digits
Need a long random number?
Multiply the random variable by 1000000000000 if you for example want 10 digits, and use the round() function to round it to the nearest whole number.
round(random*10000000000)
= 3029472548
Or multiply by 100000 if you want 5 digits. Simply change the amount of zeros for the amount of digits you want.
round(random*100000)
= 93728
That’s it!
Random round-robin
Want to split data evenly across multiple routes in a scenario?
To make sure each route gets an equal share, a round-robin approach is ideal.
In this case, the numbers aren’t purely random since we want every number to appear equally.
To achieve this, use the increment function along with the formula below.
(1. i+1)%3
= 0, 1 or 2
This will return 0 on the first scenario execution, then 1, then 2, and then loop back to 0 again.
Check out the round-robin tutorial to learn how it works.
Conclusion
I hope this helps you to create random numbers for your automation projects in Make.com 🤓
If you’ve any questions or ideas, let me know in the comments below.
I tried this for a project, and it worked like a charm! Thx for the tips! 😊
Awesome! 😄
How do you make sure the numbers are truly random? Can you ensure no repeats? 🤔
Hey Fátima! The numbers are truly random, but repeat numbers are possible.
You can’t have truly random numbers that don’t repeat because random numbers don’t have memory. You might want to look at a round-robin solution.
Good luck!
How does it manage number repeats? Any tips?
Hey Holly! The numbers are truly random, so I won’t take into account any numbers that were already generated.
A solution could be to store the numbers into a data store, and check if the newly generated number is equal to a number in the data store, and generate a new one if it’s already in there.
Great guide! Quick question—how does the round-robin method ensure equal distribution?
Hey Peyton! It uses the increment function and calculates the remainder. See the round-robin tutorial for full explanation 🙃