Mr. Couch,
Here is twist on your random string generator.
## This routine builds an alphanumeric string that is approximatly 50% alpha (52 characters)and 50% numeric (50 characters).
## This results in nearly equal probability that an alpha or a numeric character is selected.
## Characters are selected at random from the built string to produce an output string.
## You can see that this can be readily generalized to using any source (such as an exernal file) for building the alphanumeric string with the probablity of returning any character corresponding to its frequency in the text.
on mouseUp
## some initializations
ask "How many characters do you want? (# from 1 through 9)"
put it into lengthOutputString
put empty into field 1
put empty into myNum
## this provides 50 numeric characters
repeat 5 times
put myNum & "0123456789" into myNum
end repeat

## This provides 52 letters, half upper and half lower case
put "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into myAlphaUpper
put toLower(myAlphaUpper) into myAlphaLower

put (myNum & myAlphaUpper & myAlphaLower) into myText
## Build the output string
repeat lengthOutputString times
put any character of myText after field 1
end repeat
end mouseUp

Another option for getting the output string is to randomize MyText, then select characters 1 through lengthOutputString
miscdas
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to