How to randomize Open URL

i am very new to this.
i have my app with a button that opens up a youtube video playlist i created.
what i would like instead is the button to open up a random video from that playlist.
any thoughts how to randomize the selection however keep the selection from within the playlist?
i’ve been searching for the answer for a couple days so figured i would try here.
thank you much for your time.

Hi Joseph, welcome to the community!

To pick a random URL, you could

  1. create a page variable if type List of Texts, and add the video URLs as initial values
  2. Get a random index between 0 and the last index of your URLs list with RANDOM_INTEGER_BETWEEN()
  3. Find the final index with COUNT(pageVars.URLs) - 1
  4. Access the URL at the random index with: pageVars.URLs[...]

The Open URL input as a formula would then be:

pageVars.URLs[RANDOM_INTEGER_BETWEEN(0, COUNT(pageVars.URLs) - 1)]

i can not thank you enough.
i actually am overwhelmed how quick and great of a response i got.
i think i love appguyver for life haha
thx again
just hope my beginner fingers can make that all happen haha
I’m so excited to build my first little app
thx again

1 Like

im like actually crying
im not sure how it happened but i got it to work
i mean i know you’re instructions were the key but i had to play with them quite a bit and things weren’t working and i kept moving puzzle pieces around and now it works and i don’t understand why but I’m happy haha so thank you so much