当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何利用当前时间生成随机函数?

如何利用当前时间生成随机函数?

2017年12月08日  | 移动技术网IT编程  | 我要评论
quote.asp<%set myfileobj = server.createobject("scrip

quote.asp

<%
set myfileobj = server.createobject("scripting.filesystemobject")
set mytextfile = myfileobj.opentextfile("c:\quote.txt")

' 设置好路径.
if not mytextfile.atendofstream then
header = cint(mytextfile.readline)

' 读表头.

end if
randomize

' 生成基于表头的随机数, randomize语句对确保一个随机数非常重要.
randomvalue = int(header*rnd)+1
count=0
'
循环直到行号等于随机数,保存在变量引用.
while not mytextfile.atendofstream and not count = randomvalue
quote = mytextfile.readline
count = count + 1
wend
'
关闭文本文件.
mytextfile.close
%>
<html>

<body>
现在引用的是: <%=quote%>
</body></html>

[1]

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网