Random value - Array size

Almos

New member
When setting the option to take a random value in a variable, allow you to take as values (at least the final value) the reference to another variable such as "array size".

In this way, the system could automatically choose randomly from different listings with a different number of sizes, one at random with no problem that the chosen position does not exist. Example: I have a list of 20 words, if I put the random value between 0 and 19 it will be perfect, but if I then renew the array variable and take another list with 10 words, the maximum and minimum values should be adapted to the new situation Min 0, maximum 9).

Best regards
 

MacroDroidDev

Administrator
Staff member
You can do something like the following:

Generate a random number between 0 -> 1,000,000 into an integer varuable (e.g. call random)

Then take the modulo based on the array length into an integer variable (e.g. randomIndex)

randomIndex = random % arrayLength
 
Top