How to make a random number

Hello guys!
I will show you how to create random numbers for beginners and normal programmers in this post and maybe you want to create a lottery and the following codes can help you.

a code for create random number (can be used in random number apps) the code is tested and it worked, last test is on August 5 - 2023.
so you can use it for creating apps like generator or random code apps and you can save it, when app opened your saved number will be uploaded in any components with this codes.

1 Like

How do you know where one number ends and the next begins?

Should be in Tutorials and Guides

Needs PU attention


@TIMAI2 your code is random integer from 100000 to 999999 this can maybe make any number, but do you think the number can be 111111 or 999999? These numbers are useless but my code numbers 100% cannot be same number if you set numbers to this code

you can try it... after 1000 try you cant get same numbers

I do not understand @ABG can you say it better?

why would you want to prevent this scenario?

Single block is limited to the number 1073741823 and if you want to create a larger number, you need to use your method. But it is enough to use a combination of e.g. 2 randomization blocks, you don't need 6 of them.

I made a test project, failed to draw the same number.

test_random_number.aia (4.3 KB)

Even if you do draw the same number twice, this is still random, and possible :wink:


You mentioned using the numbers for a lottery.

In all the lotteries I have seen, the lottery ticket has a list of numbers in the range 1 to 100.

By using a text join, you squeeze out the intervening blanks between the numbers, ending up with just one long number.

A Make a List block would have preserved number boundaries.

@Patryk_F I just did my own method to show my way, thanks for your suggestion I will think about it.

Another way (ensures output number does not start with a zero)

:clap: :clap: :clap:

1 Like