Jump to content
Sign in to follow this  

Random Number Generator?

Recommended Posts


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.


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

Share this post

Link to post
Share on other sites

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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.