Autor Thema: Zufallspasswörter mit n Stellen erzeugen  (Gelesen 2267 mal)

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.728
  • Geschlecht: Männlich
Zufallspasswörter mit n Stellen erzeugen
« am: 11.04.02 - 17:27:12 »
Hier mal was für die Admins: ;D ;D

Zufallspasswörter mit n Stellen erzeugen



Sub Click(Source As Button)
     Msgbox createRandomPW(19)
End Sub

Function CreateRandomPw(iNumChars As Integer) As String
     Dim x As Integer
     Dim newPw As String
     Dim pwChar As String
     
     Randomize
     pwChar = ""
     newPw = ""
     For x = 1 To iNumChars
           pwChar = GetAChar()
           newPw = newPw & pwChar
     Next
     
     CreateRandomPw = newPw
     
End Function

Function GetAChar As String
     
     Dim num As Single
     Dim done As Variant
     
     done = False
     
     Do Until Done
           num = Rnd 'Generate a number between 0 and 1
           num = num * (10 ^2) 'Make the number 2 digits
           If (Round(num, 0) >=10 And Round(num, 0) <= 12) Then 'If the number is between 10 and 12 then
                                           'make it three digits. We want to capture the characters between 100 and 122
                 num = num * 10 'Make the number three digits
           End If
           num = Round(num, 0) 'Make the number a whole number
           If (num >= 65 And num <=90) Or (num >= 97 And num <= 122) Then 'Ensure that it is a alpha character
                 GetAChar = Chr$(num) '
                 done = True
           End If
     Loop
End Function
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz