假如在题库中抽取100个记录,其中50个是单选题,50个是多选,我想实现抽取20个单选,10个多选,如在单选题中抽取时遇到有2个问的题时,总抽选题数就少1个,保持问题总数为20个,如何实现,请各位专家老师,指点一下,谢谢
Dim cnt As Integer = DataTables("题库").DataRows.Count
Dim ids1 As New List(of Integer)
Dim ids2 As New List(of Integer)
For i As Integer = 0 To cnt -1
ids1.add(i)
Next
For i As Integer = 0 To cnt - 1
ids2.Add(ids1(rand.Next(0,ids1.count)))
Next
Tables("题库").StopRedraw()
DataTables("题库").ReplaceFor("选择",False)
For i As Integer = 0 To args(0) -1 '100为要抽取的行数
DataTables("题库").DataRows(ids2(i))("选择") = True
If Functions.Execute("Q_Number",DataTables("题库").DataRows(ids2(i))("题目内容"),"(?)" ) > 1 Then
i += 1
msgbox(i)
End If
Next
Tables("题库").Filter = "[选择] = True"
Tables("题库").ResumeRedraw()