Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Random String???

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Sep 26, 2001
1,605
US
How should I go about creating a random alpha-numeric string of 8 chars? It does not have to be unique, but at least random (what are the chances of a random alpha-numeric string 8 chars long being repeated anyway?) It is for sort of a temporary password.
thanks


Kevin
 
Code:
iStr = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789"
n = 0
s = ""
length = 8
randomize
for x=1 to length
	n= Int(Rnd * len(iStr))
	s= s + Mid(iStr,n +1 ,1)
Next
i think this should work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top