asp 随机字符串函数 可自定义字符串

这个方法不错,可以生成小写字符跟数字的随机字符串,大家可以加入一些特殊字符和一些大写字母等。
*************************************
'asp计算随机数
'*************************************
Function randomStr(intLength)
Dim strSeed, seedLength, pos, Str, i
strSeed = "abcdefghijklmnopqrstuvwxyz1234567890"
seedLength = Len(strSeed)
Str = ""
Randomize
For i = 1 To intLength
Str = Str + Mid(strSeed, Int(seedLength * Rnd) + 1, 1)
Next
randomStr = Str
End Function

评论

此博客中的热门博文

[转贴]江西潘阳陈振翊报警被警方击毙事件始末

龙脊梯田景区

你的妈妈已经等了二十几年