Choosing a random member of a list

Ask gaming related questions
DaveyW
Posts: 2
Joined: 10 May 2024, 01:39

Choosing a random member of a list

10 May 2024, 05:37

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?
User avatar
Noitalommi_2
Posts: 274
Joined: 16 Aug 2023, 10:58

Re: Choosing a random member of a list

10 May 2024, 13:13

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
DaveyW
Posts: 2
Joined: 10 May 2024, 01:39

Re: Choosing a random member of a list

11 May 2024, 04:09

Thanks. This gives me some direction. Appreciated

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 12 guests