Jump to content

Random Numbers


Guest DrObvious
 Share

Recommended Posts

Guest DrObvious

I'm trying to put random numbers in my script, and I have the random function in there, but each time through my loop I get the same number. Do I need to put in some kind of seed or anything else?

Right now, my code looks like:

$x = Random(1,$rval)

And then it goes on to some if/then statements that depend on $x. Every time I go through the loop, $x always ends up as 8 (which is what I have $rval set as).

Link to comment
Share on other sites

Hmm, random numbers look fine in this test:

For $i = 1 to 10

ToolTip( Random(1,8) , 0,0)

sleep(500)

Next

Ah, maybe you are expecting an integer value! Try:

$x = Int(1+Random(1, $rval))

I imagine all the other cases are failing, and it defaults to the Else-case.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...