国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP中一個用VBScript寫的隨機數類

2024-05-04 11:02:52
字體:
來源:轉載
供稿:網友
外國人寫的一個class,這么一點小小的應用,除非有特殊需求,還沒有必要模塊化。
用asp產生一個隨機數。
<% 
''************************************************************************** 
'' CLASS: cRandom 
'' Calls randomize to seed the random number generator. 
'' Provides functions for returning ranged random integers or arrays of 
'' ranged random integers. 
'' Calling randomize to seed the random number generator at the time the 
'' class is created seemed like a reasonable thing to do. 
private sub Class_Initialize() 
'' Check the VBScript documentation for the specifics relating 
'' to the Randomize function 
Randomize 
end sub 
'' Terminate doesn''t need to do anything for this class 
private sub Class_Terminate() 
end sub 
''********************************************************************** 
'' FUNCTION: RangedRandom 
'' PARAMETER: lowerBound, the lowest allowable number to return 
'' PARAMETER: upperBound, the highest allowable number to return 
'' RETURNS: A random integer between lowerBound and UpperBound, 
'' inclusive 
''********************************************************************** 
public function RangedRandom( lowerBound, upperBound ) 
RangedRandom = CInt((upperBound - lowerBound) * Rnd + lowerBound) 
end function 
''********************************************************************** 
'' FUNCTION: RangedRandomArray 
'' PARAMETER: lowerBound, the lowest allowable number to return 
'' PARAMETER: upperBound, the highest allowable number to return 
'' PARAMETER: arraySize, zero based number specifying the size of the array 
'' PARAMETER: duplicates, true or false to indicate whether duplicate 
'' resize the tempArray to hold the number of elements passed in the 
'' arraySize parameter 
redim tempArray(arraySize) 
'' This is a loop counter, set it to 0 
filledElements = 0 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 蓬溪县| 左云县| 三门峡市| 新邵县| 元江| 宽城| 南汇区| 土默特左旗| 常州市| 嘉义县| 新竹市| 西昌市| 汤阴县| 新津县| 苗栗市| 泗阳县| 安多县| 通化市| 汝城县| 疏勒县| 平谷区| 开封市| 巴林左旗| 隆德县| 伊金霍洛旗| 齐齐哈尔市| 绵竹市| 米易县| 宁波市| 镇雄县| 思茅市| 佳木斯市| 探索| 郯城县| 托里县| 康保县| 江城| 凤庆县| 全椒县| 南郑县| 陆河县|