用ASP编程语言实现生成随机字符串
2014-07-31 22:11
246 查看
<%
Function GetRandom(RandomLength)
'定义并初始化数组
dim char_array(80)
'初始化数字
For i = 0 To 9
char_array(i) = CStr(i)
Next
'初始化大写字母
For i = 10 To 35
char_array(i) = Chr(i + 55)
Next
'初始化小写字母
For i = 36 To 61
char_array(i) = Chr(i + 61)
Next
Randomize '初始化随机数生成器
do while len(output) < RandomLength
num = char_array(Int((62 - 0 + 1) * Rnd + 0))
output = output + num
loop
GetRandom = output
End Function
response.write "本实例生成的20位随机字符串为:"
response.write "<br><br>"
response.write GetRandom(20)
response.end()
%>
代码摘自:http://www.kxcom.net/jishu/asp_cjgndsx.html
Function GetRandom(RandomLength)
'定义并初始化数组
dim char_array(80)
'初始化数字
For i = 0 To 9
char_array(i) = CStr(i)
Next
'初始化大写字母
For i = 10 To 35
char_array(i) = Chr(i + 55)
Next
'初始化小写字母
For i = 36 To 61
char_array(i) = Chr(i + 61)
Next
Randomize '初始化随机数生成器
do while len(output) < RandomLength
num = char_array(Int((62 - 0 + 1) * Rnd + 0))
output = output + num
loop
GetRandom = output
End Function
response.write "本实例生成的20位随机字符串为:"
response.write "<br><br>"
response.write GetRandom(20)
response.end()
%>
代码摘自:http://www.kxcom.net/jishu/asp_cjgndsx.html
相关文章推荐
- ASP生成随机字符串(数字+大小写字母)的代码
- 生成大量随机字符串不同实现方式的效率对比
- PHP生成指定随机字符串的简单实现方法
- 随机生成指定长度字符字符串(C语言实现)
- 生成大量随机字符串不同实现方式的效率对比
- 随机生成字符串实现
- [学习笔记] 随机生成字符串实现
- bobojavascript、asp.net 实现随机生成验证码
- ASP.NET生成两个日期范围内随机时间的实现方法
- Asp 生成随机字符串13位(循环输出500次无报错)
- 生成大量随机字符串不同实现方式的效率对比
- 生成大量随机字符串不同实现方式的效率对比
- PHP封装函数实现生成随机的字符串验证码
- CreateKeyWord asp实现的由给定的字符串生成关键字的代码
- Asp生成十三位随机字符串
- ASP生成随机字符串
- asp生成随机字符串
- Python实现生成随机日期字符串的方法示例
- php开发笔记(七)用数组函数实现生成随机字符串
- ASP.NET生成两个日期范围内随机时间的实现方法