Function nbrealea(rng As range, mini, maxi)
Dim tbl(), i, a, num
ReDim tbl(1 To rng.Cells.Count)
Do
num = Round(Rnd * maxi)
x = Application.IfError(Application.Match(num, tbl, 0), 0)
If num > mini And x = 0 Then a = a + 1: tbl(a) = num
Loop While a < UBound(tbl)
With Application
nbrealea = IIf(.ThisCell.Offset(1).Formula = .ThisCell.Formula, .Transpose(tbl), tbl)
End With
End Function