Click or drag to resize
Accord.NET (logo)

GeneratorSeed Property

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.

Namespace:  Accord.Math.Random
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public static Nullable<int> Seed { get; set; }
Request Example View Source

Property Value

Type: NullableInt32
Remarks

Adjusting the global generator seed causes the calling thread to sleep for 100ms so new threads spawned in a short time span after the call can be properly initialized with the new random seeds. In order to better control the random behavior of different algorithms, please consider specifying random generators directly using appropriate interfaces for these algorithms in case they are available.

If you do not need to change the seed number for threads other than the current, you can adjust the random seed for the current thread using ThreadSeed instead. Setting ThreadSeed should not introduce delays.

See Also