Re : mélanger aléatoirement des résultat
salut à tous , on modifiant le code précédant comme ceci ,
Sub combinaisons()
Dim lin As Long, col As Long
Dim m As Integer, n As Integer, o As Integer, p As Integer, q As Integer
Dim x As Long, y As Long
Dim tableau() As Double, alea As Double
Dim compteur As Long
Dim doublon As Boolean
lin = 1
col = 1
For m = 1 To 49
For n = m + 1 To 49
For o = n + 1 To 49
For p = o + 1 To 49
For q = p + 1 To 49
Cells(lin, col) = m & " " & n & " " & " " & o & " " & p & " " & q
lin = lin + 1
If lin > 65536 Then
col = col + 1
lin = 1
End If
Next q
Next p
Next o
Next n
Next m
Randomize Timer
MsgBox "Veuillez patienter pendant le tirage aléatoire (environ 5 à 10 secondes)."
' on stocke les tirages aléatoires dans un tableau
lin = Cells(Rows.Count, 1).End(xlUp).Row
ReDim tableau(lin)
Do
alea = Rnd() * 100000
doublon = False
For y = 1 To lin
If tableau(y) = alea Then
doublon = True
Exit For
End If
Next y
If doublon = False Then
compteur = compteur + 1
tableau(compteur) = alea
End If
Loop Until compteur = lin
For y = 1 To lin
Cells(y, 2) = tableau(y)
Next y
Cells.Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
End Sub:
ça ne mélange pas tous et surtout la moitié des combinaison disparaisse
avez vous une solution ?