Bonjour,
Sans information complémentaire (supérieur strictement ou supérieur ou égal...), voici un premier jet.
Le code VBA utilise 2 Méthodes différentes.
Sub AleaEntreBornes()
Dim AleaF1 As Integer, AleaH1 As Integer, AleaJ1 As Integer
Dim RandomF1 As Integer, RandomH1 As Integer, RandomJ1 As Integer
Randomize Timer
For i = 1 To 10
'méthode par l'évaluation de la formule de calcul ALEA.ENTRE.BORNES
AleaF1 = Application.Evaluate("=RANDBETWEEN(0,15)")
AleaH1 = Application.Evaluate("=RANDBETWEEN(" & AleaF1 & ",19)")
AleaJ1 = Application.Evaluate("=RANDBETWEEN(" & AleaH1 + 1 & ",20)")
'Méthode par le générateur de nombres aléatoires
RandomF1 = CInt(15 * Rnd())
RandomH1 = CInt(((19 - RandomF1) * Rnd()) + RandomF1)
RandomJ1 = CInt(((20 - RandomH1) * Rnd()) + RandomH1)
Debug.Print AleaF1 & " , " & AleaH1 & " , " & AleaJ1 & " ---- " & RandomF1 & " , " & RandomH1 & " , " & RandomJ1
Next i
End Sub
Sinon, c'est également possible par formule directement dans le classeur :
En F1 : =ALEA.ENTRE.BORNES(0;15)
En H1 : =ALEA.ENTRE.BORNES(G1;19)
En J1 : =ALEA.ENTRE.BORNES(I1;20)