B
Badass Scotsman
Hello,
This code is supposed to generate a random string each run, however I have
had it live on a few sites, and it seems to create repeat strings all over
the place.
-------------------------------------------------------------
<%
FUNCTION GetRandomCode(randomcode,codelength,numberofcombinations)
codecharacters = 35
codearray = Array("a","b","c","d","e","f","g","h","i","j","k","l", _
"m","n","o","p","q","r","s","t","u","v","w","x", _
"y","z","1","2","3","4","5","6","7","8","9")
FOR x = 1 TO codelength
RANDOMIZE
thiscode = (Int(((codecharacters - 1) * Rnd) + 1))
totalcode = totalcode & codearray(thiscode)
IF numberofcombinations = "" THEN numberofcombinations = 1
numberofcombinations = numberofcombinations * codecharacters
NEXT
randomcode = totalcode
END FUNCTION
CALL GetRandomCode(randomcode,35,numberofcombinations)
%>
-------------------------------------------------------------
Any you guys care to help?
Thanks in advance,
Badass.
This code is supposed to generate a random string each run, however I have
had it live on a few sites, and it seems to create repeat strings all over
the place.
-------------------------------------------------------------
<%
FUNCTION GetRandomCode(randomcode,codelength,numberofcombinations)
codecharacters = 35
codearray = Array("a","b","c","d","e","f","g","h","i","j","k","l", _
"m","n","o","p","q","r","s","t","u","v","w","x", _
"y","z","1","2","3","4","5","6","7","8","9")
FOR x = 1 TO codelength
RANDOMIZE
thiscode = (Int(((codecharacters - 1) * Rnd) + 1))
totalcode = totalcode & codearray(thiscode)
IF numberofcombinations = "" THEN numberofcombinations = 1
numberofcombinations = numberofcombinations * codecharacters
NEXT
randomcode = totalcode
END FUNCTION
CALL GetRandomCode(randomcode,35,numberofcombinations)
%>
-------------------------------------------------------------
Any you guys care to help?
Thanks in advance,
Badass.