Jump to content

Recommended Posts

Posted

I am new to AutoIt, I know how to use random function.

Is it possible to use random function from a list? for example (in pseudo code):
random, a, 6, 5, 9, b, 5, tt, k, 44, 3d

when the random function is called, one of the above list is picked.

Is this possible ? If so how to implement this?

Thanks,
Mathijs
 

  • Developers
Posted

Hi Mathijs,

Anything is possible when you set your mind to it. Just put these values intoan Array and randomly pick one of the array values.
Just to give you the idea::

dim $aValues[10] = ["a", "6", "5", "9", "b", "5", "tt", "k", "44", "3d"]

For $x = 1 To 50
    $rValue = $aValues[Random(0, UBound($aValues)-1, 1)]
    ConsoleWrite('$rValue = ' & $rValue & @CRLF)
Next

Jos

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.
  :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...