IGLib
1.5
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. More... | |
RandomGenerator (int seed) | |
Initializes a new instance of random generator, using the specified seed value. More... | |
![]() | |
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 |
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#.
|
inline |
Initializes a new instance of random generator, using a time-dependent default seed value.
|
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. |
|
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.
|
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.
|
inlinestatic |
Creates and returns a new random generator initialized with a time dependent seed. The returned generator IS THREAD SAFE.
|
inlinestatic |
Creates and returns a new random generator initialized with a specified seed.
The returned generator IS THREAD SAFE.
|
staticprivate |
|
staticprotected |
|
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().