Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Random Password Generator
Author:
Franz Träxler
E-mail:
Click to e-mail author
Website:
http://www.mstm.at
Submitted:
11/11/2003
Version:
VB6
Compatibility:
VB6
Category:
String Manipulation
Views:
15578
Function to generate random Id's and passwords.
Declarations:
Declare Function GetTickCount Lib "kernel32" _ () As Long
Code:
Public Function PassGen(nLen As Integer) Dim range As Collection Dim ivalue, icount, iLen As Long Dim pass As String Set range = New Collection range.Add ("0") range.Add ("1") range.Add ("2") range.Add ("3") range.Add ("4") range.Add ("5") range.Add ("6") range.Add ("7") range.Add ("8") range.Add ("9") icount = 0 ivalue = 0 iLen = range.Count Do Until icount = nLen Randomize ivalue = CByte(Mid(CStr(Rnd(GetTickCount)), 3, 2)) If ivalue > 0 And ivalue <= iLen Then icount = icount + 1 pass = pass & range(ivalue) End If Loop PassGen = pass End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement