Table of Contents

RandomNumber Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Generate.cs

RandomNumber(int)

Generates a random integer that is within a specified range.

public static int RandomNumber(int maximumExclusive = 2147483647)

Parameters

maximumExclusive int

The exclusive upper bound of the random number returned. maximumExclusive must be greater than or equal to 0.

Returns

int

A 32-bit signed integer greater than or equal to 0 and less than maximumExclusive; that is, the range of return values includes 0 but not maximumExclusive. If 0 equals maximumExclusive, 0 is returned.

RandomNumber(int, int)

Generates a random integer that is within a specified range.

public static int RandomNumber(int minimumInclusive, int maximumExclusive)

Parameters

minimumInclusive int

The inclusive lower bound of the random number returned.

maximumExclusive int

The exclusive upper bound of the random number returned. maximumExclusive must be greater than or equal to minimumInclusive.

Returns

int

A 32-bit signed integer greater than or equal to minimumInclusive and less than maximumExclusive; that is, the range of return values includes minimumInclusive but not maximumExclusive. If minimumInclusive equals maximumExclusive, minimumInclusive is returned.

Exceptions

ArgumentOutOfRangeException

minimumInclusive is greater than maximumExclusive.