Click or drag to resize
Accord.NET (logo)

Generator Class

Framework-wide random number generator. If you would like to always generate the same results when using the framework, set the Seed property of this class to a fixed value.
Inheritance Hierarchy
SystemObject
  Accord.Math.RandomGenerator

Namespace:  Accord.Math.Random
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public static class Generator
Request Example View Source

The Generator type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberHasBeenAccessed
Gets a value indicating whether the random number generator has been used during the execution of any past code. This can be useful to determine whether a method or learning algorithm is fully deterministic or not. Note that it is also possible for a method to be non-deterministic even if it uses the random number generator if it use multiple threads.
Public propertyStatic memberLastUpdateTicks
Gets the timestamp for when the global random generator was last changed (i.e. after setting Seed).
Public propertyStatic memberRandom
Gets a reference to the random number generator used internally by the Accord.NET classes and methods. Objects retrieved from this property should not be shared across threads. Instead, call this property from each thread you would like to use a random generator for.
Public propertyStatic memberSeed
Sets a random seed for the framework's main internal number generator. Preferably, this method should be called before other computations. If set to a value less than or equal to zero, all generators will start with the same fixed seed, even among multiple threads. If set to any other value, the generators in other threads will start with fixed, but different, seeds.
Public propertyStatic memberThreadLastUpdateTicks
Gets the timestamp for when the thread random generator was last changed (i.e. after creating the first random generator in this thread context or by setting ThreadSeed).
Public propertyStatic memberThreadSeed
Gets or sets the seed for the current thread. Changing this seed will not impact other threads or generators that have already been created from this thread.
Top
Remarks

By setting Seed to a given value, it is possible to adjust how random numbers are generated within the framework. Preferably, this property should be adjusted before other computations.

If the Seed is set to a value that is less than or equal to zero, all generators will start with the same fixed seed, even among multiple threads. If set to any other value, the generators in other threads will start with fixed, but different, seeds.

See Also