# Help with Random

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:
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
 Revision history for this message Richard Vela (socalemt) said on 2021-03-01: #1

Will this work??
——Code——

Import random

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

 Revision history for this message Chetan (cshamdas) said on 2021-03-01: #2
 Revision history for this message Richard Vela (socalemt) said on 2021-03-01: #3

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

 Revision history for this message Chetan (cshamdas) said on 2021-03-01: #4

ok understood then earlier solution posted by Richard should work

 Revision history for this message TestMechanic (ndinev) said on 2021-03-02: #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())

 Revision history for this message Richard Vela (socalemt) said on 2021-03-02: #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?

 Revision history for this message Richard Vela (socalemt) said on 2021-03-02: #7

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

For example:

wait(random.randint(10.9, 20.8))

 Revision history for this message TestMechanic (ndinev) said on 2021-03-16: #8

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

 Revision history for this message Andrew Crowdy (flamingphoenix) said on 2021-09-11 #9

You can explore online casinos to find good examples of working with random numbers. https://gamblerschoice.net/free-slots/3-reel/ handle their randomizers perfectly.