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

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Static Protected Attributes | Properties | Static Private Attributes

# 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:
[legend]
Collaboration diagram for IG::Num::RandomGenerator:
[legend]

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:

  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.

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

IRandomGenerator IG::Num::RandomGenerator::_global = null`[static, private]`

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:

- Random.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events