How to list functions and choose one at random?

I would like to be able to add certain functions to a list and randomly call one of them
Is there a more dynamic way of doing this than my example below?

1 Like

If your functions are in a list then you need to call it using the random option instead of the number option.

Such as this:

image

1 Like

How do you add functions to a list in the first place?

1 Like

If you are interested in listing the function name then add them to the list. If in the other hand you want a block to execute a function as a parameter to that block then this is not yet available in Thunkable or at least I have no knowledge of it.

1 Like

No, this is the only way to call a random function from more than one option.

Another way to set this up would be to create just a single function with an input value and then pass the random number to the function. Within the function, you would still need the if/elseif blocks to determine the code to run for each input value. I’m not sure that’s an improvement!

2 Likes

Yes I was hoping to randomly choose one of the functions to execute it.

Thanks for the help guys