C# Класс AForge.ThreadSafeRandom

Thread safe version of the System.Random class.

The class inherits the System.Random and overrides its random numbers generation methods providing thread safety by guarding call to the base class with a lock. See documentation to System.Random for additional information about the base class.

Наследование: System.Random
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Next ( ) : int

Returns a nonnegative random number.

See Random.Next() for more information.

Next ( int maxValue ) : int

Returns a nonnegative random number less than the specified maximum.

See Random.Next(int) for more information.

Next ( int minValue, int maxValue ) : int

Returns a random number within a specified range.

See Random.Next(int,int) for more information.

NextBytes ( byte buffer ) : void

Fills the elements of a specified array of bytes with random numbers.

See Random.NextBytes(byte[]) for more information.

NextDouble ( ) : double

Returns a random number between 0.0 and 1.0.

See Random.NextDouble() for more information.

ThreadSafeRandom ( ) : System

Initializes a new instance of the ThreadSafeRandom class.

See Random.Next() for more information.

ThreadSafeRandom ( int seed ) : System

Initializes a new instance of the ThreadSafeRandom class.

A number used to calculate a starting value for the pseudo-random number sequence. If a negative number is specified, the absolute value of the number is used.See Random.Next() for more information.

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

Next() публичный Метод

Returns a nonnegative random number.
See Random.Next() for more information.
public Next ( ) : int
Результат int

Next() публичный Метод

Returns a nonnegative random number less than the specified maximum.
See Random.Next(int) for more information.
public Next ( int maxValue ) : int
maxValue int The exclusive upper bound of the random number to be generated. /// must be greater than or equal to zero.
Результат int

Next() публичный Метод

Returns a random number within a specified range.
See Random.Next(int,int) for more information.
public Next ( int minValue, int maxValue ) : int
minValue int The inclusive lower bound of the random number returned.
maxValue int The exclusive upper bound of the random number returned. /// must be greater than or equal to .
Результат int

NextBytes() публичный Метод

Fills the elements of a specified array of bytes with random numbers.
See Random.NextBytes(byte[]) for more information.
public NextBytes ( byte buffer ) : void
buffer byte An array of bytes to contain random numbers.
Результат void

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

Returns a random number between 0.0 and 1.0.
See Random.NextDouble() for more information.
public NextDouble ( ) : double
Результат double

ThreadSafeRandom() публичный Метод

Initializes a new instance of the ThreadSafeRandom class.
See Random.Next() for more information.
public ThreadSafeRandom ( ) : System
Результат System

ThreadSafeRandom() публичный Метод

Initializes a new instance of the ThreadSafeRandom class.
A number used to calculate a starting value for the pseudo-random number sequence. If a negative number is specified, the absolute value of the number is used. See Random.Next() for more information.
public ThreadSafeRandom ( int seed ) : System
seed int
Результат System