Bonjours j aimerais faire un petite application qui me donne 5 chiffre aux hazard ( de 1 a 50)+ 2 autres chiffres de (1 a 9) comme plus besoin de reflchir a des nombre quand je vex jouer a euro million .
Pour les chiffres de 1 a 50 ca cava il m en sort 5 a chaque fois différents mais pour les 2 autres chiffres il me sort un zero pour le 2 eme a chaque fois et je ne trouve pas mon erreur voici le code
Private Sub Command1_Click()
Dim t(1 To 5) As Integer, b(1 To 2) As Integer
Dim i As Integer, j As Integer
'nombres aléatoires Timer fourni un nombre qui change d'une exécution à l'autre
Randomize Timer
'int= reel en ententier
t(1) = Int(Rnd * 50) + 1
For i = 2 To 5
t(i) = Int(Rnd * 50) + 1
For j = (i - 1) To 1 Step -1
If t(i) = t(j) Then
i = i - 1
Exit For
End If
Next j
Next i
b(1) = Int(Rnd * 9) + 1
For i = 1 To 2
t(i) = Int(Rnd * 9) + 1
For j = (i - 1) To 1 Step -1
If b(i) = b(j) Then
i = i - 1
Exit For
End If
Next j
Next i
For i = 1 To 5
Label1.Caption = Label1.Caption & Str(t(i)) & Chr(13)
Next i
For i = 1 To 2
Label2.Caption = Label2.Caption & Str(b(i)) & Chr(13)
Next i
End Sub
Si quelle c est me donner un petit coup de pouce merci d avance