Creates a ThreadSafeRandom instance using the specified factory in each thread the result is accessed from.
See the Remarks section for details.
See the Remarks section for details.
Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.5.0-rc.1
Syntax
Parameters
- factory
- Type: SystemFuncRandom
A delegate that will be invoked once in each thread the created instance is used from.
Return Value
Type: ThreadSafeRandomA ThreadSafeRandom instance using the specified factory in each thread the result is accessed from.
Remarks
Make sure the created instance is disposed if it is not used anymore even if the created instances are not disposable.
Disposing the created instance disposes also the Random instances created by the factory if the created Random instances are disposable.
![]() |
---|
If factory creates a pseudo random number generator, then in order not to produce the same sequence from the different threads make sure the factory method creates instances with different seeds. |
See Also