[request] want to select randomly from a list of matches (e.g. findAll())
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
In Progress
|
Medium
|
RaiMan |
Bug Description
*** workaround on the Python level (SikuliX script):
import random
click(random.
-------
I need sikuli to choose randomly from its image recognition findings, how is that possible?
My code in this case is:
exists(
click(
There are normally a few "Spectate"s, but it mostly clicks on the same one.
Is there a possiblility to make it randomized intentionally?
Thanks!
-------
Seem to be a good idea to develop.
Look at the question to find the actual workaround.
summary: |
- [request] Add a function to select randomly in Sikuli + [request] want to select randomly from a list of matches (e.g. + findAll()) |
Changed in sikuli: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → RaiMan (raimund-hocke) |
milestone: | none → 1.2.0 |
description: | updated |
description: | updated |
description: | updated |
Changed in sikuli: | |
milestone: | 2.0.0 → 2.1.0 |
I would suggest that Sikuli doesn't need to re-invent the wheel here, python already has a lot of ways of shuffling a list. E.g if you have:
matches= findAll( pat)
Adding just one line (plus an import) will give you what you want:
from random import shuffle
matches= findAll( pat) matches)
shuffle(
Simples :-)