最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP中一個(gè)用VBScript寫的隨機(jī)數(shù)類

 更新時(shí)間:2006年08月27日 00:00:00   作者:  
外國(guó)人寫的一個(gè)class,這么一點(diǎn)小小的應(yīng)用,除非有特殊需求,還沒(méi)有必要模塊化。
用asp產(chǎn)生一個(gè)隨機(jī)數(shù)。
<% 
''************************************************************************** 
'' 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 
'' loop until filledElements is equal to the arraySize + 1 
do until filledElements = arraySize + 1 
'' Call the RangedRandom function with the lowerBound and upperBoundparameters 
tempValue = RangedRandom( lowerBound, upperBound ) 
'' Handle the case where we don''t want duplicate values 
if duplicates = false then 
badValue = false 
for i = 0 to UBound(tempArray) 
'' check if the new random value already exists in the array 
'' if it does set the badValue flag to true and break out of the loop 
if tempValue = tempArray(i) then 
badValue = true 
exit for 
end if 
next 
if badValue = false then 
tempArray(filledElements) = tempValue 
filledElements = filledElements + 1 
end if 
else 
'' Handle the case where duplicate values in the array are acceptable 
tempArray(filledElements) = tempValue 
filledElements = filledElements + 1 
end if 
loop 
'' return the array 
RangedRandomArray = tempArray 
end function 
end class 
%> 
<% 
'' All the code that follows is example code showing the use of the 
'' cRandom class. 
dim objRandom 
dim flip 
dim randomArray 
dim rowsToTest 
dim i, j 
'' create an instance of our class 
set objRandom = new cRandom 
'' set the number of iterations that we want to test 
rowsToTest = 10 
'' "toggle" to determine whether or not we set the bgcolor of the table row 
flip = true 
'' Start the table 
Response.Write "<table border=0 cellpadding=1 cellspacing=1>" 
for j = 0 to rowsToTest 
'' We''ll alternate the bgcolor of the table rows based on the 
'' value of the flip variable 
if flip then 
Response.Write "<tr bgcolor=LightGrey>" 
else 
Response.Write "<tr>" 
end if 
'' Call the RangedRandomArray function for testing purposes 
randomArray = objRandom.RangedRandomArray( 1, 10)
  • EasyASP v1.5發(fā)布(包含數(shù)據(jù)庫(kù)操作類,原clsDbCtrl.asp)

    EasyASP v1.5發(fā)布(包含數(shù)據(jù)庫(kù)操作類,原clsDbCtrl.asp)

    EasyASP是一個(gè)方便快速開發(fā)ASP的類,其中包含了一個(gè)數(shù)據(jù)庫(kù)控制類(原clsDbCtrl.asp,對(duì)原代碼作了優(yōu)化和修改,包含對(duì)數(shù)據(jù)庫(kù)的各類操作及存儲(chǔ)過(guò)程的調(diào)用,全部封裝在Easp.db中,使用起來(lái)會(huì)更方便,調(diào)用也更簡(jiǎn)單)。
    2008-10-10
  • ASP類Class入門 推薦

    ASP類Class入門 推薦

    我們常??吹絼e的程序語(yǔ)言中中都有類的說(shuō)明,PHP,VB,C++,這個(gè)在VBScript中的類的說(shuō)明,我是第一次聽(tīng)到,我們的日常工作就是網(wǎng)站開發(fā),在這個(gè)里面多多少少搞出點(diǎn)經(jīng)驗(yàn),像模像樣也能自詡為內(nèi)行,所以我就來(lái)分享一下我所知道的這個(gè)新的東東
    2006-08-08
  • ASP 使用三層架構(gòu) asp中使用類

    ASP 使用三層架構(gòu) asp中使用類

    Class在asp中出現(xiàn)蠻久了,不過(guò)很少看到它被用在代碼當(dāng)中.記得當(dāng)年研究動(dòng)網(wǎng)的論壇程序的時(shí)候,看到了一些例子,當(dāng)時(shí)還覺(jué)得比較崇拜----對(duì)自己沒(méi)用過(guò)的技術(shù).
    2009-09-09
  • asp:debug類調(diào)試程序

    asp:debug類調(diào)試程序

    asp:debug類調(diào)試程序...
    2007-02-02
  • Access 2000 數(shù)據(jù)庫(kù) 80 萬(wàn)記錄通用快速分頁(yè)類

    Access 2000 數(shù)據(jù)庫(kù) 80 萬(wàn)記錄通用快速分頁(yè)類

    Access 2000 數(shù)據(jù)庫(kù) 80 萬(wàn)記錄通用快速分頁(yè)類...
    2007-03-03
  • ASP中一個(gè)用VBScript寫的隨機(jī)數(shù)類

    ASP中一個(gè)用VBScript寫的隨機(jī)數(shù)類

    ASP中一個(gè)用VBScript寫的隨機(jī)數(shù)類...
    2006-08-08
  • 最新評(píng)論

    罗江县| 汕头市| 宝山区| 河南省| 体育| 海淀区| 阳春市| 七台河市| 江西省| 普洱| 高尔夫| 尤溪县| 嘉荫县| 海门市| 木兰县| 田林县| 渑池县| 南澳县| 南溪县| 巨鹿县| 隆化县| 冷水江市| 汽车| 和龙市| 海盐县| 铁力市| 宜都市| 通山县| 克山县| 老河口市| 辛集市| 磐安县| 石楼县| 兴文县| 湛江市| 清远市| 调兵山市| 宿松县| 和龙市| 射阳县| 平原县|