Really easy with AHK.
For an example if we are choosing a choice between Rock,Paper and Scissors the most common approach will be to choose a random number and do some if-else statements like so:
Random,Coice_Num,1,3 If (Choice_Num = 1) Choice = "Rock" else if (Choice_Num = 2) Choice = "Num" else if (Choice_Num = 3) Choice = "Num"
What if there were like . . 20, 30 choices? Then we would have a problem.
We need to write a lot of if-else statements which can get really messy.
So here is the situation. I got a list of 53 stuff and i need a 20 random Choices. This is how i'd do it:
Loop, 20 MsgBox % Random_Choice("glow stick", "needle", "stop sign", "blouse", "hanger", "rubber duck", "shovel", "bookmark", "model car", "tampon", "rubber band", "tire swing", "sharpie", "picture frame", "photo album", "nail filer", "tooth paste", "bath fizzers", "tissue box", "deodorant ", "cookie jar", "rusty nail", "drill press", "chalk", "word search", "thermometer ", "face wash", "paint brush", "candy wrapper", "shoe lace", "leg warmers", "wireless control", "boom box", "quilt", "stockings", "card", "tooth pick", "shawl", "speakers ", "key chain", "cork", "helmet", "mouse pad", "zipper", "glasses", "lamp shade", "sketch pad", "gage", "plastic fork", "flag", "clay pot", "check book", "CD") Random_Choice(Choices*){ Random,Index,1,% Choices.MaxIndex() Return,Choices[Index] }
I hope this might come in useful in your scripts.
And btw, should i have posted this in the tutorials forum? or is it okay to post it here? I wasn't really sure.