21/11/2020, 22:50
alicimri
Aşağıdaki kod 31'e kadar sıralanmış sorudan, 6 adetnin sıra numarasını benzersiz rastgele seçiyor.
Kod:
Sub a()
Ssoru = 6
Tsoru = 31
Do While say < Ssoru
Randomize
ilk = Int((Tsoru * Rnd) + 1)
If InStr(1, yaz, "'" & ilk & "'") = 0 Then
yaz = yaz & "'" & ilk & "'"
say = say + 1
End If
Loop
MsgBox Replace(Replace(yaz, "''", "*"), "'", "")
End Sub