문자열을 받아서 난수로 문자를 조합해서 값을 되돌려 주는 함수입니다.
<%
Function MyRandom( couponLength, couponString )
Const defaultString = "ABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
Dim nCount, sRet, nNumber, nLength
Randomize '초기화
If couponString = "" Then
couponString = defaultString
End If
nLength = Len( couponString )
For nCount = 1 To couponLength
nNumber = Int((nLength * Rnd) + 1)
sRet = sRet & Mid( couponString, nNumber, 1 )
Next
'리턴값
MyRandom = sRet
End Function
%>
<%
Response.Write "쿠폰넘버: " & MyRandom( 15, "" )
%>