IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Default generator of uniformly distributed random numbers. Provides a global generator and a static function for generating new generators. Currently, the generator used is the system's generator built in C#. More...
Public Member Functions | |
RandomGenerator () | |
Initializes a new instance of random generator, using a time-dependent default seed value. | |
RandomGenerator (int seed) | |
Initializes a new instance of random generator, using the specified seed value. | |
Static Public Member Functions | |
static IRandomGenerator | Create () |
Creates and returns a new random generator initialized with a time dependent seed. WARNING: The returned generator is NOT THREAD SAFE. Use GetThreadSafe() for a thread safe generator. | |
static IRandomGenerator | Create (int seed) |
Creates and returns a new random generator initialized with a specified seed. | |
static IRandomGenerator | CreateThreadSafe () |
Creates and returns a new random generator initialized with a time dependent seed. The returned generator IS THREAD SAFE. | |
static IRandomGenerator | CreateThreadSafe (int seed) |
Creates and returns a new random generator initialized with a specified seed. | |
Static Protected Attributes | |
static object | _lock = new Object() |
Properties | |
static IRandomGenerator | Global [get] |
Global random generator. Initialized with time dependent seed. Therefore, the generator should generate different sequences each time the application is run, but it can nod be used to create deterministic sequences because seeding with a specified value is not possible. The returned generator is thread safe. It is initialized when first accessed. | |
Static Private Attributes | |
static IRandomGenerator | _global = null |
Default generator of uniformly distributed random numbers. Provides a global generator and a static function for generating new generators. Currently, the generator used is the system's generator built in C#.
IG::Num::RandomGenerator::RandomGenerator | ( | ) | [inline] |
Initializes a new instance of random generator, using a time-dependent default seed value.
IG::Num::RandomGenerator::RandomGenerator | ( | int | seed | ) | [inline] |
Initializes a new instance of random generator, using the specified seed value.
seed | 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. |
static IRandomGenerator IG::Num::RandomGenerator::Create | ( | ) | [inline, static] |
Creates and returns a new random generator initialized with a time dependent seed. WARNING: The returned generator is NOT THREAD SAFE. Use GetThreadSafe() for a thread safe generator.
static IRandomGenerator IG::Num::RandomGenerator::Create | ( | int | seed | ) | [inline, static] |
Creates and returns a new random generator initialized with a specified seed.
The returned generator is NOT THREAD SAFE. Use GetThreadSafe(seed) for a thread safe generator.
static IRandomGenerator IG::Num::RandomGenerator::CreateThreadSafe | ( | ) | [inline, static] |
Creates and returns a new random generator initialized with a time dependent seed. The returned generator IS THREAD SAFE.
static IRandomGenerator IG::Num::RandomGenerator::CreateThreadSafe | ( | int | seed | ) | [inline, static] |
Creates and returns a new random generator initialized with a specified seed.
The returned generator IS THREAD SAFE.
IRandomGenerator IG::Num::RandomGenerator::_global = null [static, private] |
object IG::Num::RandomGenerator::_lock = new Object() [static, protected] |
IRandomGenerator IG::Num::RandomGenerator::Global [static, get] |
Global random generator. Initialized with time dependent seed. Therefore, the generator should generate different sequences each time the application is run, but it can nod be used to create deterministic sequences because seeding with a specified value is not possible. The returned generator is thread safe. It is initialized when first accessed.