Jump to content
Sign in to follow this  
JStone

Random Number Generator?

Recommended Posts

JStone

Basically, I'm looking to create a random number between two values, such as 5150ms and 6230ms. I would be using it as a sleep between a macro.

Example:

For $count = 1 To 5000
    sleep(5000)
    MouseClick("left")
    sleep(x) ;where 'x' is a random number between 5150-6230
Next

Share this post


Link to post
Share on other sites
omikron48

Yes. Where you generate the number is based on whether you want it to change every loop or just once.

To generate a number between [a,b], you just use this equation:

a + R * (b - a)

where R is U[0,1) (uniformly random between 0 and 1)

Edited by omikron48

Share this post


Link to post
Share on other sites
TurionAltec

Random() function

SRandom(Timerinit())
For $count = 1 To 5000
    sleep(5000)
    MouseClick("left")
    sleep(Random(5150,6230,1)) ;where 'x' is a random number between 5150-6230
Next
Edited by TurionAltec

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×