NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Random.Next (Int32, Int32)

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;

Parameters

minValue
The lower bound of the random number to be generated. It can be any integer less than or equal to Int32.Max.
maxValue
The upper bound of the random number to be generated. It must be an integer number greater than or equal to minValue and less than or equal to Int32.Max.

Return Value

A number that is greater than or equal to minValue and less than maxValue. If minValue equals maxValue, minValue is returned.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException if minValue is greater than maxValue.

Remarks

The seed is adjusted as a side effect of this call. Multiple calls to Next will yield different numbers.

See Also

Random Class | Random Members | System Namespace | Random.Next Overload List