Pick a random text string

Hi there, I aim to choose one random „Compose a string" module and then add a row to Google Sheets. In the first Compose a string text module content is „:purple_circle: Someone texted you!” and in the second one „New message!". After that, I want to pick a random one and use it to add a row in Google Sheets. I have tried with the Set variable module, floor, and random functions but it seems like it’s only for numbers, so I was getting the “Not a number error”. :smiley:

Anyone? :smiley:

You can do it using a single “Set variable” module like this:

{{ if(round(random) = 0; "Someone texted you!"; "New message!") }}


Thank you so much @samliew, that works perfectly for me!

Also, if in the future anyone would look for help with using modules – you can do It as well, just change the text in @samliew function to your module <3

1 Like

Revisiting this question, if you want to get a random value from more than two items, use the array shuffle() function:

{{ first(shuffle(add(emptyarray; "Someone texted you!"; "New message!"; "Third option"; "Fourth option"))) }}