← 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: Answered => Open

alceal is still having a problem:
Thanks, Rai. You're alright. listOptions has strings.

One question: in paste('running AppX: Please, choose" +
random.choice(listOptions)), AppX is chosed randomly too. So it must
paste that AppX too. e.g. running App1: Please, choose...; running App2:
Please choose...; etc.

Other question: if I want non exactly random choice. I mean: On one
hand: App1 60%, App2 30% and App3 10% and the other hand Option1 50%,
Option2 25% and Option3 25%.

I tried this one succesfully:

import random

rNum = random.random()

if rNum < float(6)/10:
    click(ima1,png)
elif rNum > float(6)/10 and rNum < float(9)/10
   click(img2.png)
else:
   click(img3.png)

How could I use it in my problem?

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