1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Public Function GetRandom(ByVal minimum As Integer, ByVal maximum As Integer) As Integer
Try
Dim nRandom As Integer
Randomize()
nRandom = CInt(minimum + (maximum - minimum + 1) * Rnd())
While nRandom < minimum OrElse nRandom > maximum
Randomize()
nRandom = CInt(minimum + (maximum - minimum + 1) * Rnd())
End While
Return nRandom
Catch ex As Exception
'ToDo Fehlerbehandlung
Return minimum
End Try
End Function
|