This ways are very elaborate, most times you can use a simple function like this.
Note: the static declaration makes this object, maintain its last place, so it is like having it outside the function.
Note: the static declaration makes this object, maintain its last place, so it is like having it outside the function.
Code
Function EZ_Random(ByVal Min As Integer, ByVal Max As Integer)
Static RndObj As New Random
Return RndObj.Next(Min, Max)
End Function