random.asp

来自「集合了学习asp的100个实例」· ASP 代码 · 共 32 行

ASP
32
字号
<%@ LANGUAGE = VBScript %> 

<%  Option Explicit     %>   

<HTML>     

<HEAD>         

<TITLE>用Tools组件生成随机整数</TITLE>     

</HEAD>      

<BODY BGCOLOR="White" topmargin="10" leftmargin="10">           

<!-- Display Header -->          

<font size="4" face="Arial, Helvetica">         

<b>用Tools组件生成随机整数</b></font><br>                

<hr size="1" color="#000000">  

<% Dim Tools  

Dim FoundFile, FileExists, FileDoesNotExist, NotFoundFile 

Dim RandInt, RandPosInt, RandIntBelow  

Set Tools = Server.CreateObject("MSWC.Tools") %>   

<h3>随机整数实例</h3>  

<% ' Random Integer  

RandInt = Tools.Random 

Response.Write "随机整数: " 

Response.Write RandInt 

Response.Write "<BR>"   



RandPosInt = Abs( Tools.Random ) 

Response.Write "随机整数的绝对值: " 

Response.Write RandPosInt 

Response.Write "<BR>"   



RandIntBelow =  Abs( Tools.Random ) Mod 200 

Response.write "小于200的随机整数: " 

Response.write RandIntBelow 

Response.write "<BR>" %>     

</BODY> </HTML> 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?