Mono Class Library: System.Random Overview | Members

System.Random.Next Method

Returns a psuedo-random number within a specified range.

public virtual int Next (int minValue, int maxValue)

Parameters

minValue
The lower bound of the random number returned.
maxValue
The upper bound of the random number returned.

Returns

A psuedo-random number greater than or equal to minValue and less than maxValue. If minValue and maxValue are equal, this value is returned.

Exceptions

TypeReason
ArgumentOutOfRangeExceptionminValue is greater than maxValue.

Remarks

Operation
As described above.

Note to Inheritors
Override this method to customize the algorithm used to generate the return value.

Usage
Use this method to generate psuedo-random numbers in a specified range.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0