← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #246742]: How to choose randomly from several lists and use them?

 

Question #246742 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/246742

    Status: Open => Answered

RaiMan proposed the following answer:
ok, you can do the same, but evaluate an index this way:

only using your example, has to be adapted as needed:


rNum = random.random()

if rNum < float(6)/10:
    ixa = 0
elif rNum > float(6)/10 and rNum < float(9)/10
  ixa = 1
else:
   ixa = 2

# same for ixo (listOptions)

click(listApps[ix])
paste('running App%d: Please, choose %s" %(ixa, listOptions[ixo)))

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.