Jump to content

Recommended Posts

Posted

hello... is there a way to use the Random function with letters, like: Random (a, z)

or is there a work around to this to get random letters? :idiot:

thanks!! :D

FootbaG
Posted

Straight from the help file example:

;Random letter
If Random() < 0.5 Then
   ;Capitals
    $Letter = Chr(Random(Asc("A"), Asc("Z"), 1))
Else
   ;Lower case
    $Letter = Chr(Random(Asc("a"), Asc("z"), 1))
Endif

If you want a bunch of letters, simply put in a loop:

Dim $i, $word = ""
For $i = 1 to 10
 ;INSERT ABOVE CODE HERE
  $word = $word & $letter
Next
MsgBox(4096,"Result", $word)
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

hmmm... actually doesnt work, because theres only one paremeter in Chr () and there is 3 in the help files example, so i get the error message: "Error parsing function call."

sorry im really really tired if there is somthing big im missing... :idiot:

FootbaG
Posted

This didn't work for me either, looks like its an addition to the new beta then to have steps in the random function. I just removed the 3rd variable from each.

;Random letter
If Random() < 0.5 Then
  ;Capitals
    $Letter = Chr(Random(Asc("A"), Asc("Z")))
Else
  ;Lower case
    $Letter = Chr(Random(Asc("a"), Asc("z")))
Endif
Posted (edited)

Cyber, I think it has to do with the random() additions and decimals...

I'm going to the online doc to look at it...

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Posted

maybe i dont have the up-to-date beta, but i know im using it, ill check when i get back from school..

FootbaG
Posted

This didn't work for me either, looks like its an addition to the new beta then to have steps in the random function. I just removed the 3rd variable from each.

;Random letter
If Random() < 0.5 Then
  ;Capitals
    $Letter = Chr(Random(Asc("A"), Asc("Z")))
Else
  ;Lower case
    $Letter = Chr(Random(Asc("a"), Asc("z")))
Endif

<{POST_SNAPBACK}>

thanks :D works great! :idiot:
FootbaG

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
×
×
  • Create New...