Dequality Posted June 27, 2017 Posted June 27, 2017 Got a simple question is it possible to have lets say 10 functions and use the random function to randomly pick one of them? If so could anyone please make a tiny example? Tyvm in advance -Dequality
Developers Jos Posted June 27, 2017 Developers Posted June 27, 2017 That shouldn't be too hard to come up with yourself when using Random() and Call() functions. Jos Xandy 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
czardas Posted June 27, 2017 Posted June 27, 2017 Or use an array of functions. Global $aFunc = [Buzz, Noisy, Lazy] For $i = 1 To 10 $aFunc[Random(0, 2, 1)]() Next Func Buzz() Beep(175, 750) EndFunc Func Noisy() Beep() EndFunc Func Lazy() Sleep(1000) EndFunc Xandy, Gianni and kylomas 3 operator64 ArrayWorkshop
Dequality Posted July 1, 2017 Author Posted July 1, 2017 On 27/6/2017 at 10:34 PM, czardas said: Or use an array of functions. Global $aFunc = [Buzz, Noisy, Lazy] For $i = 1 To 10 $aFunc[Random(0, 2, 1)]() Next Func Buzz() Beep(175, 750) EndFunc Func Noisy() Beep() EndFunc Func Lazy() Sleep(1000) EndFunc Tyvm 😎
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now