C# Класс ByChance.Core.Random2

Implementation of the Ranq1 struct found in Numerical Recipes in C: 3rd Edition. Combined generator (Ranq1 = D1(A1(right-shift first)) with a period of 1.8 x 10^19.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
NextDouble ( ) : double

Gets the next random number in the sequence and returns it as a double-precision floating-point number between 0.0 and 1.0.

NextFloat ( ) : float

Gets the next random number in the sequence and returns it as a single-precision floating-point number between 0.0f and 1.0f.

NextInt32 ( ) : int

Gets the next random number in the sequence and returns it as a 32-bit signed integer.

NextInt32 ( int maxExclusive ) : int

Gets the next random number in the sequence and returns it as a 32-bit signed integer with the specified upper bound.

NextInt64 ( ) : long

Gets the next random number in the sequence and returns it as a 64-bit signed integer.

NextInt64 ( long maxExclusive ) : long

Gets the next random number in the sequence and returns it as a 64-bit signed integer with the specified upper bound.

Random2 ( ) : System

Constructs a new random number generator with the current system time as seed.

Random2 ( long seed ) : System

Constructs a new random number generator with the given 64-bit unsigned integer as seed.

Приватные методы

Метод Описание
NextUInt64 ( ) : ulong

Gets the next random number in the sequence and returns it as a 64-bit unsigned integer.

Описание методов

NextDouble() публичный метод

Gets the next random number in the sequence and returns it as a double-precision floating-point number between 0.0 and 1.0.
public NextDouble ( ) : double
Результат double

NextFloat() публичный метод

Gets the next random number in the sequence and returns it as a single-precision floating-point number between 0.0f and 1.0f.
public NextFloat ( ) : float
Результат float

NextInt32() публичный метод

Gets the next random number in the sequence and returns it as a 32-bit signed integer.
public NextInt32 ( ) : int
Результат int

NextInt32() публичный метод

Gets the next random number in the sequence and returns it as a 32-bit signed integer with the specified upper bound.
public NextInt32 ( int maxExclusive ) : int
maxExclusive int /// Exclusive upper bound on the number to get. ///
Результат int

NextInt64() публичный метод

Gets the next random number in the sequence and returns it as a 64-bit signed integer.
public NextInt64 ( ) : long
Результат long

NextInt64() публичный метод

Gets the next random number in the sequence and returns it as a 64-bit signed integer with the specified upper bound.
public NextInt64 ( long maxExclusive ) : long
maxExclusive long /// Exclusive upper bound on the number to get. ///
Результат long

Random2() публичный метод

Constructs a new random number generator with the current system time as seed.
public Random2 ( ) : System
Результат System

Random2() публичный метод

Constructs a new random number generator with the given 64-bit unsigned integer as seed.
public Random2 ( long seed ) : System
seed long /// 64-bit unsigned integer to use as seed. ///
Результат System