Random result from CMS when the button is clicked

Hi guys!

How can I give out a random item from the cms when I click on a button?


I have a CMS with 100 values. I want the user to be shown a random one of those values when they click on the button. Then he can click again to see another one. And so until he gets bored or finds the right one.

Is this possible? Thanks!

hi @FlowKeeper you will need to create an array from items and use Math.floor Math.random and length of an array. The formula can looks like :
arr[Math.floor(Math.random() * arr.length]


1 Like