function testRand()
randomize
testRand=Rnd
end function
for x = 1 to 10
response.write testRand&"<br>"
next
<script language="vbscript" runat="server">
Sub StrRandomize(strSeed)
Dim i, nSeed
nSeed = CLng(0)
For i = 1 To Len(strSeed)
nSeed = nSeed Xor ((256 * ((i - 1) Mod 4) * AscB(Mid(strSeed, i, 1))))
Next
'Randomiser
Randomize nSeed
End Sub
'--GeneratePassword(nLength)
'--Generates friendly passwords for remembering and pronounciation
Function GeneratePassword(nLength)
Dim i, bMadeConsonant, c, nRnd
'You may adjust the below constants to include local,
'eg. scandinavian characters. This way your passwords
'will not be limited to latin characters.
Const strDoubleConsonants = "bdfglmnpst"
Const strConsonants = "bcdfghklmnpqrstv"
Const strVocal = "aeiou"
GeneratePassword = ""
bMadeConsonant = False
For i = 0 To nLength
'Get a random number number between 0 and 1
nRnd = Rnd
'Simple or double consonant, or a new vocal?
'Does not start with a double consonant
'15% or less chance for the next letter being a double consonant
If GeneratePassword <> "" AND (bMadeConsonant <> True) AND (nRnd < 0.15) Then
'double consonant
c = Mid(strDoubleConsonants, Int(Len(strDoubleConsonants) * Rnd + 1), 1)
'response.write int(Len(strDoubleConsonants) * Rnd + 1)
'response.write "<br>"
c = c & c
i = i + 1
bMadeConsonant = True
Else
'80% or less chance for the next letter being a consonant,
'depending on wether the last letter was a consonant or not.
If (bMadeConsonant <> True) And (nRnd < 0.95) Then
'Simple consonant
c = Mid(strConsonants, Int(Len(strConsonants) * Rnd + 1), 1)
bMadeConsonant = True
'5% or more chance for the next letter being a vocal. 100% if last
'letter was a consonant - theoreticaly speaking...
Else
'If last one was a consonant, make vocal
c = Mid(strVocal,Int(Len(strVocal) * Rnd + 1), 1)
bMadeConsonant = False
End If
End If
'Add letter
GeneratePassword = GeneratePassword & c
Next
'Is the password long enough, or perhaps too long?
If Len(GeneratePassword) > nLength Then
GeneratePassword = Left(GeneratePassword, nLength)
End If
End Function
StrRandomize CStr(Now) & CStr(Rnd)
</script>
----Dim SPInsertPassword__Password
SPInsertPassword__Password = "0"
if(EncrytPswd( GeneratePassword( 10 ) ) <> "") then SPInsertPassword__Password = EncrytPswd( GeneratePassword( 10 ) )
function testRand()
randomize
testRand=Rnd
end function
for x = 1 to 10
response.write testRand&"<br>"
next
<script language="vbscript" runat="server">
Sub StrRandomize(strSeed)
Dim i, nSeed
nSeed = CLng(0)
For i = 1 To Len(strSeed)
nSeed = nSeed Xor ((256 * ((i - 1) Mod 4) * AscB(Mid(strSeed, i, 1))))
Next
'Randomiser
Randomize nSeed
End Sub
'--GeneratePassword(nLength)
'--Generates friendly passwords for remembering and pronounciation
Function GeneratePassword(nLength)
Dim i, bMadeConsonant, c, nRnd
'You may adjust the below constants to include local,
'eg. scandinavian characters. This way your passwords
'will not be limited to latin characters.
Const strDoubleConsonants = "bdfglmnpst"
Const strConsonants = "bcdfghklmnpqrstv"
Const strVocal = "aeiou"
GeneratePassword = ""
bMadeConsonant = False
For i = 0 To nLength
'Get a random number number between 0 and 1
nRnd = Rnd
'Simple or double consonant, or a new vocal?
'Does not start with a double consonant
'15% or less chance for the next letter being a double consonant
If GeneratePassword <> "" AND (bMadeConsonant <> True) AND (nRnd < 0.15) Then
'double consonant
c = Mid(strDoubleConsonants, Int(Len(strDoubleConsonants) * Rnd + 1), 1)
'response.write int(Len(strDoubleConsonants) * Rnd + 1)
'response.write "<br>"
c = c & c
i = i + 1
bMadeConsonant = True
Else
'80% or less chance for the next letter being a consonant,
'depending on wether the last letter was a consonant or not.
If (bMadeConsonant <> True) And (nRnd < 0.95) Then
'Simple consonant
c = Mid(strConsonants, Int(Len(strConsonants) * Rnd + 1), 1)
bMadeConsonant = True
'5% or more chance for the next letter being a vocal. 100% if last
'letter was a consonant - theoreticaly speaking...
Else
'If last one was a consonant, make vocal
c = Mid(strVocal,Int(Len(strVocal) * Rnd + 1), 1)
bMadeConsonant = False
End If
End If
'Add letter
GeneratePassword = GeneratePassword & c
Next
'Is the password long enough, or perhaps too long?
If Len(GeneratePassword) > nLength Then
GeneratePassword = Left(GeneratePassword, nLength)
End If
End Function
Randomize
StrRandomize CStr(Now) & CStr(Rnd)
</script>
<%
Dim firstNumber, firstLower, firstUpper, firstOther, latterNumber, _
latterLower, latterUpper, latterOther, passwordLength, extraChars
firstNumber = "true"
firstLower = "true"
firstUpper = "true"
firstOther = "false"
latterNumber = "true"
latterLower = "true"
latterUpper = "true"
latterOther = "false"
passwordLength = 10
extraChars = "@$!"
Function getRandomNum(lbound, ubound)
For j = 1 To (250 - ubound)
Randomize
getRandomNum = Int(((ubound - lbound) * Rnd) + 1)
Next
End Function
Function getRandomChar(number, lower, upper, other, extra)
numberChars = "0123456789"
lowerChars = "abcdefghijklmnopqrstuvwxyz"
upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
otherChars = "`~!@#$%^&*()-_=+[{]}\\|;:"""'\,<.>/? "
charSet = extra
if (number = "true") Then charSet = charSet + numberChars
if (lower = "true") Then charSet = charSet + lowerChars
if (upper = "true") Then charSet = charSet + upperChars
if (other = "true") Then charSet = charSet + otherChars
jmi = Len(charSet)
getRandomChar = Mid(charSet, getRandomNum(1, jmi), 1)
End Function
Function getPassword(length, extraChars, firstNumber, firstLower, _
firstUpper, firstOther, latterNumber, latterLower, latterUpper, latterOther)
rc = ""
If (length > 0) Then
rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars)
End If
For idx = 1 To length - 1
rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars)
Next
getPassword = rc
End Function
strUltraPass = getPassword(passwordLength, extraChars, _
firstNumber, firstLower, firstUpper, firstOther, _
latterNumber, latterLower, latterUpper, latterOther)
%>
<%Session("svPassword") = strUltraPass%>
----Dim SPInsertPassword__Password
SPInsertPassword__Password = "0"
if(EncrytPswd( Session("svPassword") ) <> "") then SPInsertPassword__Password = EncrytPswd( Session("svPassword") )
<%
function makeWord()
Dim max,min
max=122
min=97
Randomize
number = (Int((max-min+1)*Rnd+min))
makeWord =chr(number)
end function
newPass=""
for x =1 to 10
newPass=newPass&makeWord
next
response.write newPass
%>
Title | # Comments | Views | Activity |
---|---|---|---|
Vb script to unzip a files and rename the files | 12 | 70 | |
Summernote required | 3 | 57 | |
VBS Script not working correctly. | 1 | 21 | |
Using VB6 to write Excel Spreadsheets - | 5 | 18 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
14 Experts available now in Live!