Returns a random number within a specified range.
[Visual Basic] Overloads Overridable Public Function Next( _ ByVal minValue As Integer, _ ByVal maxValue As Integer _ ) As Integer [C#] public virtual int Next( int minValue, int maxValue ); [C++] public: virtual int Next( int minValue, int maxValue ); [JScript] public function Next( minValue : int, maxValue : int ) : int;
A number that is greater than or equal to minValue and less than maxValue. If minValue equals maxValue, minValue is returned.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | if minValue is greater than maxValue. |
The seed is adjusted as a side effect of this call. Multiple calls to Next will yield different numbers.
Random Class | Random Members | System Namespace | Random.Next Overload List