Random.NextInt64 Method

Definition

Overloads

NextInt64()

Returns a non-negative random integer.

NextInt64(Int64)

Returns a non-negative random integer that is less than the specified maximum.

NextInt64(Int64, Int64)

Returns a random integer that is within a specified range.

NextInt64()

Returns a non-negative random integer.

public:
 virtual long NextInt64();
public virtual long NextInt64 ();
abstract member NextInt64 : unit -> int64
override this.NextInt64 : unit -> int64
Public Overridable Function NextInt64 () As Long

Returns

A 64-bit signed integer that is greater than or equal to 0 and less than Int64.MaxValue.

Applies to

NextInt64(Int64)

Returns a non-negative random integer that is less than the specified maximum.

public:
 virtual long NextInt64(long maxValue);
public virtual long NextInt64 (long maxValue);
abstract member NextInt64 : int64 -> int64
override this.NextInt64 : int64 -> int64
Public Overridable Function NextInt64 (maxValue As Long) As Long

Parameters

maxValue
Int64

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

Returns

A 64-bit signed integer that is greater than or equal to 0, and less than maxValue; that is, the range of return values ordinarily includes 0 but not maxValue. However, if maxValue equals 0, maxValue is returned.

Exceptions

maxValue is less than 0.

Applies to

NextInt64(Int64, Int64)

Returns a random integer that is within a specified range.

public:
 virtual long NextInt64(long minValue, long maxValue);
public virtual long NextInt64 (long minValue, long maxValue);
abstract member NextInt64 : int64 * int64 -> int64
override this.NextInt64 : int64 * int64 -> int64
Public Overridable Function NextInt64 (minValue As Long, maxValue As Long) As Long

Parameters

minValue
Int64

The inclusive lower bound of the random number returned.

maxValue
Int64

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

Returns

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

Exceptions

minValue is greater than maxValue.

Applies to