IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::RandomGenerator Class Reference

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...

Inheritance diagram for IG::Num::RandomGenerator:
Collaboration diagram for IG::Num::RandomGenerator:

List of all members.

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

Detailed Description

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#.


Constructor & Destructor Documentation

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.

Parameters:
seedA 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.

Member Function Documentation

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.


Member Data Documentation

object IG::Num::RandomGenerator::_lock = new Object() [static, protected]

Property Documentation

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events