Random number procedure with options (min, max, howMany, noRepeat, sorted, ascending)

Here’s my procedure to create a list of random numbers, with these options

Minimum
Maximum
How many numbers
Repeat or unique numbers
Sorted or unsorted
Sort order ascending or descending

I hope somebody find it useful and most of all, can learn something of it.GenerateRandomNumbers_function.aia (15.0 KB)

13 Likes

Thanks for sharing.

I have the same opinion regarding extension. I rarely use extension.

I would like to see more of this kind of opensource instead of more kind of A+B extension.

4 Likes

Thanks! I have lots of procedures I made to include in projects as painless as possible, like this procedure, which you can just copy using the backpack. Nothing else is required.
I will try to share those soon. Time has been scarce lately.

3 Likes

Sorry for my english (google translator…)
Block code very interesting, but as an inexperienced I would like to ask you something. I would like to make an App that pulls numbers for a lottery with a button that, if clicked, displays the extracted number. If I use the central example of the “call” and write “1” in “howmany” with every click I get an extraction that does not consider the previous extractions (“no repeat” function does not work), but if I write the total of extractable numbers as can I display them one at a time in a label by clicking on a button each time? Thanks if you want to give me some help :slight_smile:

noRepeat function works just fine, You are not using it correctly.
The noRepeat parameter applies only to the current list generated, not to previous ones.
So in this case you have to generate a list of all the numbers you need not repeated, and not to call the procedure for each number you need.
When you have the list of non repeated numbers, generated with the function, then you can select random numbers from that list.

1 Like

HI @Italo it’s really great procedure. I tried it it works fine. I have little 1 query. I use this to generate random numbers on button click and show in a label. The numbers show as (0218421) . Is there any way to remove brackets (), number display like 0218421 instead of (0218421).
Well thank you for share a great think with us.

The result of my procedure is a LIST of numbers, not A number. That’s why it has ().
Now if you want to use that list as a single number, you can use the REPLACE ALL TEXT block, to replace the ( for an empty space. Do the same with the ).