توليد 100 رقم عشوائيا بين 0 و 100 (بدون تكرار)
- التفاصيل
- الزيارات: 3914
Dim RanNo() As Long
Private Sub RandomizeNumbers(ByVal iFrom As Integer, ByVal iTo As Integer)
ReDim RanNo(iFrom To iTo)
For i = iFrom To iTo
RanNo = i
Next i
Randomize (Timer)
For i = iFrom To iTo
j = CInt((iTo - iFrom) * Rnd + iFrom)
tmp = RanNo
RanNo = RanNo(j)
RanNo(j) = tmp
Next i
End Sub
Private Sub Command1_Click()
RandomizeNumbers 0, 100
For i = 0 To 100
List1.AddItem RanNo
Next i
End Sub
من منتديات الفريق العربي للبرمجة
http://www.arabteam2000.com/