Random in texts(strings)

Juanjoe

New member
Hi! How do I randomize texts (strings)? I can do it with numbers on the macrodroid. But with variables and lists (arrays) of texts (strings), I don't know yet. The random function works with texts
 

Juanjoe

New member
Hey how's it going? I made an array-type variable with three words: [0]=Hi, [1]=hello, [2]=You, And I would like to display random in a pop-up as a test. What would this example look like? Thank you very much!
 

Dm114

Well-known member
Hey how's it going? I made an array-type variable with three words: [0]=Hi, [1]=hello, [2]=You, And I would like to display random in a pop-up as a test. What would this example look like? Thank you very much!
your_array_variable[FLOOR(RANDOM()*{size=your_array_variable})]
You could also try something like your_array_variable[{system_time_ms}%{size=your_array_variable}]
 

Dimlos

Well-known member
Here are two simple examples.
 

Attachments

  • random_array_index.jpg
    random_array_index.jpg
    492.4 KB · Views: 7
  • random_array_index.macro
    4.1 KB · Views: 2
  • random_string.jpg
    random_string.jpg
    427.2 KB · Views: 7
  • random_string.macro
    1.6 KB · Views: 0
Top