Results 1 to 13 of 13

Thread: anyone has an idea on how to produce 9 random letters?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245

    anyone has an idea on how to produce 9 random letters?

    i am working on a password encryptor/decryptor and i need to produce 9 random characters from a-z every click of a button. anyone who has and idea or suggestion please help. thanks to all!!!!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    VB Code:
    1. MsgBox Chr(Int((122 - 97 + 1) * Rnd) + 97)

  3. #3
    Addicted Member
    Join Date
    May 2004
    Location
    China
    Posts
    228
    Mendhak, are you really in Ulaan Batoor?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Ugu'i.

  5. #5
    Addicted Member
    Join Date
    May 2004
    Location
    China
    Posts
    228
    Wow, I am impressed. Last time I was there was in 1997, didn't think too much of it. (Off topic, I know, sorry) What nationality are you/what do you there?

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by madjon
    Wow, I am impressed. Last time I was there was in 1997, didn't think too much of it. (Off topic, I know, sorry) What nationality are you/what do you there?
    I'm currently defacing the Great Wall of China with my Great Can of Spray Pain.

    (Off-topic stuff in PMs... or this one will get deleted.)

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245

    thanks

    thanks Mendhak.. very big help. Thank you!

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245

    ei! got a slight problem!

    the code u gave me when first fired always give me <snphhuatv> and unloaded. then when ran again gives me the same value <snphhuatv>

    what i need is when the function is called it genereates an entirely new set of 9 characters.

    need answers ASAP. Thanks!

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Post the code you're using.

  10. #10
    Addicted Member JRSofty's Avatar
    Join Date
    Jan 2004
    Location
    Somewhere in Germany
    Posts
    149
    Did you remember to use the Randomize statement?

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    philippines
    Posts
    245
    VB Code:
    1. Public Function generatePassword() As String
    2. Dim x As Integer
    3. Dim tmpStr As String
    4.  
    5. For x = 1 To 9
    6.     tmpStr = tmpStr & Chr(Int((122 - 97 + 1) * Rnd) + 97)
    7. Next
    8. generatePassword = tmpStr
    9. End Function

    this is the code try putting this function on a form and have a button call it. notice that the first set will always give you = snphhuatv =

  12. #12
    Lively Member freightliner's Avatar
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    123
    VB Code:
    1. public Function generatePassword() As String
    2. Dim x As Integer
    3. Dim tmpStr As String
    4. Randomize
    5. For x = 1 To 9
    6.     tmpStr = tmpStr & Chr(Int((122 - 97 + 1) * Rnd) + 97)
    7. Next
    8. generatePassword = tmpStr
    9. End Function
    With the randomize function there, this will not happen
    very handy: [vbcode][/vbcode]
    VB.NET - VB6 - VBA - ASP - RPG(AS/400) - C++ - java - SQL

    look in the help, many probs can be solved that way.
    I know, i'm to lazy too.

    PLEASE PUT RESOLVED IF RESOLVED!!

  13. #13
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    You need randomize only once, put it in form_load or sub main()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width