Page 1 of 1

Choosing a random member of a list

Posted: 10 May 2024, 05:37
by DaveyW
I have a list of clickable links on screen.
I would like to randomly choose one of these links.

Any ideas on the best way to do this?

Re: Choosing a random member of a list

Posted: 10 May 2024, 13:13
by Noitalommi_2
Hi.

You can use the Random function for something like this.

Code: Select all

#Requires AutoHotkey 2.0
#SingleInstance

Urls := [  "https://www.google.com/",
           "https://www.bing.com/",
           "https://yahoo.com/"]

F1::MsgBox Urls[Random(1, Urls.Length)] ; press F1 to get a random url

Re: Choosing a random member of a list

Posted: 11 May 2024, 04:09
by DaveyW
Thanks. This gives me some direction. Appreciated