bonsoir!!
j'ai fais une fonction qui remplit un tableau avec des nombre aléatoire distincts mais je sais pas pourquoi 1/5 fois elle laisse passé un tableau avec des redondance
merci de m'aidé a trouvé ce qui cloche dans mon code (malgré qu'il est logique)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 Function test(y As Integer) As Boolean w% = 1 Do While ((z(w) <> z(y)) And (w < y)) w = w + 1 Loop If (w = y) Then test = True Else test = False End If End Function Sub start() Randomize Dim i As Integer For i = 1 To 3 Do z(i) = CInt(Int(Rnd() * 15)) b = test(i) Loop Until (b = True) next i end sub
Partager