回复 10楼 shonken
好象没见到那些:70%、10%、20%
回复 11楼 吹水佬
case那里,但好像不能准确表达自定义比例
Clea nMin1 = 31&&比例1的最小值范围 nMax1 = 80&&比例1的最大值范围 nMin2 = 81 nMax2 = 100 nMin3 = 0 nMax3 = 30 nRang1 = 20 &&比例1 nRang2 = 10 &&比例2 ?x_RandRang(nRang1,nMin1,nMax1,nRang2,nMin2,nMax2,nMin3,nMax3) Function x_RandRang(nRang1,nMin1,nMax1,nRang2,nMin2,nMax2,nMin3,nMax3) nResult = 0 lcResult = "" For i = 0 To 100 nRang = Int((100 - 0 + 1) * Rand( ) + 0) Do Case Case nRang <= nRang1 nResult = Int((nMax1 - nMin1 + 1) * Rand( ) + nMin1) Case Between(nRang,nRang1 + 1 ,nRang1 + nRang2) nResult = Int((nMax2 - nMin2 + 1) * Rand( ) + nMin2) Otherwise nResult = Int((nMax3 - nMin3 + 1) * Rand( ) + nMin3) Endcase lcResult = lcResult + Transform(nResult)+"," Endfor Return lcResult Endfunc
[此贴子已经被作者于2022-12-16 14:43编辑过]