Okay i am trying to make a random number script using javascript but it wont work. I have used the same script without asp before and i wanted to know if microsofts version of javacript alows this sort of thing
I found this someplace, and modified it to make random passwords. Does this help?
~~~~~~~~~~~~~~~~~~~~~~~~~
<%
' Find range size - restrict to alpha-numerics
intRangeSizeNumber = 57 - 48
intRangeSizeUcase = 89 - 65
for J = 1 to 10
Randomize()
' Get a random number from 0 to the size of the range
RandomValueNumber = intRangeSizeNumber * Rnd()
RandomvalueUcase = intRangeSizeUcase * Rnd()
' Center the range of possible random numbers over the desired result set
RandomValueNumber = RandomValueNumber + 48
RandomValueUcase = RandomValueUcase + 65
' Convert our value to an integer
RandomIntNumber = chr(RandomValueNumber)
RandomIntUcase = chr(RandomValueUcase)
' The above 4 lines are equivilent to the popular shorter version
' below. I split it up so I could indicate what each step is doing.
' intRandomInteger = Int((intUpperBound - intLowerBound + 1) * Rnd + intLowerBound)
if 100 * Rnd < 50 then
password = password & RandomIntUCase
else
password = password & RandomIntNumber
end if
next
' Show out output indicating what we've done and our result.
Response.write "password: " & password
%>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.