Jump to content
Sign in to follow this  
jimmer

Random values

Recommended Posts

Alright... I don't quite understand what the Help file is trying to tell me...

If Random() < 0.33

Does that mean there is a 33% chance to perform the second command?

If Random() < 0.33 Then 
   ;First command
Else
   ;Second command
Endif

Also... how would I add a Third "possible" command?

Share this post


Link to post
Share on other sites

its all just hit and miss, is what it's doing is making a random number and saying that if the random number us less then 0.33 then run the first command, or else, if it's something else(IE: greater then) then run the second command, get it?


FootbaG

Share this post


Link to post
Share on other sites

random() will return a randow number between 0 and 1 ..

Code with 3 options:

$a = Random()
If $a < 0.33 Then 
  ;First command
ElseIf $a < 0.66 Then
  ;Second command
Else
  ;Third command
Endif

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...