WEB TIP/ASP
쿠폰번호 생성(랜덤번호)
제프
2008. 6. 17. 12:26
<%
Function MyRandom( couponLength, couponString )
Const defaultString = "ABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
Dim nCount, sRet, nNumber, nLengthRandomize 'init random
If couponString = "" Then
couponString = defaultString
End IfnLength = Len( couponString )
For nCount = 1 To couponLength
nNumber = Int((nLength * Rnd) + 1)
sRet = sRet & Mid( couponString, nNumber, 1 )
Next'리턴값
MyRandom = sRetEnd Function
%>
<%
Response.Write "쿠폰넘버: " & MyRandom( 15, "" )
%>
[출처] [ASP] 쿠폰번호 생성|작성자 가능성