站点图标 AI技术聚合

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

quote.aspxml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /??

<%
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]

退出移动版