IGLib  1.5
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
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:

Public Member Functions

 RandomGenerator ()
 Initializes a new instance of random generator, using a time-dependent default seed value. More...
 
 RandomGenerator (int seed)
 Initializes a new instance of random generator, using the specified seed value. More...
 
- Public Member Functions inherited from IG.Num.RandomGeneratorSystem
 RandomGeneratorSystem ()
 Initializes a new instance of random generator, using a time-dependent default seed value. More...
 
 RandomGeneratorSystem (int seed)
 Initializes a new instance of random generator, using the specified seed value. More...
 
override double NextDouble ()
 A double-precision floating point number greater than or equal to 0.0, and LESS THAN 1.0. More...
 
virtual double NextDouble (double maxValue)
 A double-precision floating point number greater than or equal to 0.0, and LESS than the specified maximum. More...
 
virtual double NextDouble (double minValue, double maxValue)
 A double-precision floating point number greater than or equal to the specified minimum, and LESS THAN the specified maximum. More...
 
virtual double NextDoubleInclusive ()
 A double-precision floating point number greater than or equal to 0.0, and LESS OR EQUAL than 1.0. More...
 
virtual double NextDoubleInclusive (double maxValue)
 A double-precision floating point number greater than or equal to 0.0, and LESS OR EQUAL than the specified maximum. More...
 
virtual double NextDoubleInclusive (double minValue, double maxValue)
 A double-precision floating point number greater than or equal to the specified minimum, and LESS OR EQUAL than the specified maximum. More...
 
override int Next ()
 Returns a nonnegative random number. More...
 
override int Next (int maxValue)
 Returns a nonnegative random number LESS THAN the specified maximum. More...
 
override int Next (int minValue, int maxValue)
 Returns a random number within a specified range (lower bound inclusive, UPPER BOUND EXCLUSIVE). More...
 
virtual int NextInclusive (int maxValue)
 Returns a nonnegative random number LESS OR EQUAL the specified maximum. More...
 
virtual int NextInclusive (int minValue, int maxValue)
 Returns a random number within a specified range (lower bound inclusive, upper bound INCLUSIVE). More...
 
override void NextBytes (byte[] buffer)
 Fills the elements of a specified array of bytes with random numbers. More...
 

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. More...
 
static IRandomGenerator Create (int seed)
 Creates and returns a new random generator initialized with a specified seed. More...
 
static IRandomGenerator CreateThreadSafe ()
 Creates and returns a new random generator initialized with a time dependent seed. The returned generator IS THREAD SAFE. More...
 
static IRandomGenerator CreateThreadSafe (int seed)
 Creates and returns a new random generator initialized with a specified seed. More...
 

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

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 ( )
inlinestatic

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)
inlinestatic

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 ( )
inlinestatic

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)
inlinestatic

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
staticprivate
object IG.Num.RandomGenerator._lock = new Object()
staticprotected

Property Documentation

IRandomGenerator IG.Num.RandomGenerator.Global
staticget

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.

Referenced by IG.Num.SampledDataSet.CreateExampleLinear(), IG.Num.SampledDataSet.CreateExampleQuadratic(), IG.Lib.IndexList.CreateRandom(), IG.Lib.IndexList.CreateRandomPermutation(), IG.Lib.StringTable.ExampleWriteCsv(), IG.Num.InputOutputElementDefinition.GetDistortedBounds(), IG.Num.BoundingBoxBase.GetRandomPoint(), IG.Num.VectorBase.OrthogonalizeGramSchmidt(), IG.Num.M.rand(), IG.Num.MExt.Rand(), IG.Num.Vector.Random(), IG.Lib.IndexList.SetRandom(), IG.Num.MatrixBase.SetRandom(), IG.Num.MatrixBase.SetRandomAntiSymmetric(), IG.Num.MatrixBase.SetRandomInvertible(), IG.Num.MatrixBase.SetRandomLowerTriangular(), IG.Lib.IndexList.SetRandomPermutation(), IG.Num.MatrixBase.SetRandomPositiveDefiniteSymmetric(), IG.Num.MatrixBase.SetRandomPositiveDiagonallyDominant(), IG.Num.MatrixBase.SetRandomSymmetric(), IG.Num.MatrixBase.SetRandomSymmetricPositiveDefinite(), IG.Num.MatrixBase.SetRandomUpperTriangular(), IG.Num.RandomGaussian.Test(), IG.Num.MatrixBase.TestCholeskyDecomposition(), IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.MatrixBase.TestLdltDecomposition(), IG.Num.MatrixBase.TestLuDecomposition(), and IG.Num.ScalarFunctionUntransformedBase.TestSpeed().


The documentation for this class was generated from the following file: