Help with Random

Asked by Richard Vela on 2021-03-01

I am currently exploring ways to randomize my code so that it becomes less predictable and more human like for a game I play. I have explored methods using import random function but all I have been able to do is randomize my sleep or wait time between two values. Such as sleep(random.randint(10,20)). Although this seems to be an effective way to randomize wait times to surpass bot detection, it seems flawed over long periods of time because 10-20 seconds will average to 15. Is there a way to add a third variable to help truly randomize my sleep/wait times? Also, can sikuli be changed to MS instead of seconds??

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
2021-03-01
Last reply:
2021-03-02
Richard Vela (socalemt) said : #1

Will this work??
 ——Code——

Import random

Click(image)
Wait(random.randint(10,20)*(random.random()))

Chetan (cshamdas) said : #2
Richard Vela (socalemt) said : #3

That post has to do with movement of the mouse. This did not help, but thank you.

Chetan (cshamdas) said : #4

ok understood then earlier solution posted by Richard should work

TestMechanic (ndinev) said : #5

You can use milliseconds in sikuli -> for example 0.1 is 100ms

For making random more random you can seed your random with time

import random
import time
random.seed(time.time())

Richard Vela (socalemt) said : #6

So would it be:

random.seed(time.time(10,20))

??

Also, how would this be more random? Would it avoid the problem of averaging over time?

Richard Vela (socalemt) said : #7

Random.randint didn’t seem to work between two numbers with decimals.

For example:

wait(random.randint(10.9, 20.8))

TestMechanic (ndinev) said : #8

Int means integer. You are asking for randint and getting it

Can you help with this problem?

Provide an answer of your own, or ask Richard Vela for more information if necessary.

To post a message you must log in.