跪求 VB 随机抽取 制作代码,有急用,请~

跪求 VB 随机抽取 制作代码,有急用,请高手指点~~
各位大侠,小弟应老师要求做课见名单抽取,要求是抽取过的名字不能参与抽取了,我被这点难倒了,该怎么做呢,请大侠帮帮忙

------解决方案--------------------
用 "抓羊羔算法 "。
大意是这样的:
从羊圈往外一只接一只地捉羊羔,捉的同时羊羔在羊圈里是乱窜的。靠近你手边捉到的那只肯定是随机的。每捉走一只,羊圈里就少一只。
SheepNabByFold函数的作用是在代表羊圈的Fold()数组里捉走一只羊羔。返回的long是被捉走的羊羔,而Fold()的对应元素随之减少。
这个算法的优势在于缩短数组、随机选择的方式相当地高效。

测试代码:

Private priFold() As Long

Private Sub Command1_Click()
If CBool(SheepCount(priFold())) Then
Text2.Text = SheepNabByFold(priFold())
Text1.Text = SheepCount(priFold())
For tIndex = 0 To SheepCount(priFold()) - 1
Text1.Text = Text1.Text & " " & priFold(tIndex)
Next
Else
Text1.Text = "没有羊了!你还乱抓什么? "
End If
End Sub

Private Sub Form_Load()
ReDim priFold(100)
For tIndex = 0 To 100
priFold(tIndex) = tIndex
Next
End Sub

函数模块

Type tpSheepFold
sfIndex As Long '指针
sfSheeps() As Long '数组
End Type

Function SheepCount(ByRef pFold() As Long) As Long
Dim tOutCount As Long

Dim tSheepIndex_Start As Long
Dim tSheepIndex_End As Long
Dim tSheepIndex_Rnd As Long

Err.Clear
On Error Resume Next

tSheepIndex_End = UBound(pFold): tSheepIndex_Start = LBound(pFold)
If Not CBool(Err.Number) Then
tOutCount = Abs(tSheepIndex_End - tSheepIndex_Start) + 1
End If

SheepCount = tOutCount
End Function

Function SheepNabByFold(ByRef pFold() As Long) As Long
Dim tOutSheep As Long
Dim tSheepIndex As Long
Dim tSheepCount As Long
Dim tSheepIndex_Start As Long
Dim tSheepIndex_End As Long
Dim tSheepIndex_Rnd As Long
Dim tFoldSpace() As Long

tSheepIndex_End = UBound(pFold()): tSheepIndex_Start = LBound(pFold())
tSheepCount = SheepCount(pFold())
tSheepIndex_Rnd = Int(Rnd * tSheepCount) + tSheepIndex_Start

SheepSwap pFold(tSheepIndex_End), pFold(tSheepIndex_Rnd)

tOutSheep = pFold(tSheepIndex_End)

If tSheepCount < 2 Then
pFold() = tFoldSpace()
Else
ReDim Preserve pFold(tSheepIndex_End - 1)
End If

SheepNabByFold = tOutSheep
End Function

Sub SheepSwap(ByRef pSheepA As Long, ByRef pSheepB As Long)
Dim tSheep As Long
tSheep = pSheepA: pSheepA = pSheepB: pSheepB = tSheep
End Sub